-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Experimental onBackpressureBufferWithCapacity #1916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experimental onBackpressureBufferWithCapacity #1916
Conversation
The operator takes an optional capacity for the buffer and a callback to be triggered when the buffer fills up.
…ckpressureBufferWithCapacity
@@ -15,23 +15,46 @@ | |||
*/ | |||
package rx.internal.operators; | |||
|
|||
import java.nio.BufferOverflowException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the use of this exception. I think it should be MissingBackpressureException
like we use elsewhere.
Updated to use |
Should we change |
Nevermind. We only call the action onOverflow once, not every item overflowed. |
This seems good enough to include in an |
…ureBufferWithCapacity Experimental onBackpressureBufferWithCapacity
Re. readability of ensureCapacity I agree, thanks for fixing that one + the exception. Re. Action1 vs. Action0 I'm leaning towards keeping Action0 because the risks seem much clearer than the hypothetical benefits of seeing the dropped item. But I don't have a strong opinion, up to you (we could always add another overload, and warn in the javadoc). I've been taking a look at the test failures but I can't see a clear cause for the deadlock (which also seem to happen on tests that as far as I can see should not use the code added here). I do reproduce it locally anyway so I'll keep looking into it and submit the fix, hopefully soon. |
Manual merge of #1899