[ASYNC-55] Notification of items dropped from sliding/dropping buffers Created: 12/Feb/14 Updated: 05/May/14
|Patch:||Code and Test|
I would like to know when items are dropped from sliding or dropping buffers, so that I can do things like logging and keeping metrics.
The attached patch has one possible mechanism for doing this, by adding an optional second argument to sliding-buffer and dropping-buffer - a one-argument function that will be called with dropped items.
|Comment by Ghadi Shayban [ 22/Apr/14 10:41 AM ]|
Hi Chris, I think this use-case can be handled the combination of a go process + collection directly without modification to the existing buffer impls. I'd be concerned about making buffers pay for a non-essential field.
I like using the library primitives to make sure they are minimally complete.
(If you really really want to make your own buffer, no one will stop you =) It's still an impl protocol, but it's relatively stable. Just beware that buffer operations run within the context of a channel lock, so make sure to dispatch the overflow function to the async threadpool using dispatch/run).