Conversation
|
Love this addition! Currently Subscribers/InputStreams take TWO parameters to dictate leaky behavior; one boolean to set it as a leaky queue and another to dictate how many messages should be queued before leaking occurs. This feels like it should just be one parameter, and I'd argue for just the
I believe it's unexpected behavior when a One very important note -- because of this, we actually end up with a weird edge case when someone sets |
…nto feat/leaky-sub
|
Alright, so I took another pass over this and got rid of an |
There are many times where you may have a subscriber that does something slow, but doesn't need every message; for example visualization which may take a while for a particular message, but we don't need to render EVERY one of them. It would be ideal if these subscribers do NOT cause backpressure, and instead drop older messages.
This PR implements that feature using a few keyword arguments for
InputStreams, as well asSubscribers.leaky = False: If True, drop oldest messages when queue is full.max_queue = None: Maximum queue size (ignored if leaky=False). Ifleaky = True,max_queuedefaults to 1.There is also a new example and tests to verify the functionality.