Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent FluxBufferTimeout requests < 0 when enough outstanding (#2892)
This commit puts a simple guard against negative request in the BufferTimeoutSubscriber#request method in order to cover cases where discrepancies are introduced by the timeouts. Specifically, this covers a scenario where delivery from upstream is partial then times out, while downstream requests a small number of buffers. For instance: - with buffer size 10, let's assume a first request of 2 buffers - let's also assume the source is slow to emit at first and delivers 2 elements, then times out => first buffer request is met with timeout - then it emits one more element and stalls again => second buffer request is met with timeout also - `request(1)` comes in from downstream At this point we have `outstanding` at `2x10 - 3` = `17`. A request for one buffer translates to `requestLimit = 10`. We have sufficient outstanding request to cover for that buffer and in `requestMore(n)` where `n = requestLimit - outstanding`, `n` is negative. => this commit prevents that negative request. Fixes #2839.
- Loading branch information