You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why
===
Currently the send buffer has no backpressure, so if a user of the river
client sends too many messages too quickly, the send buffer will
overflow and the client will error out.
Rather than relying on users to rate limit themselves, we introduce
backpressure so client naturally will only send messages as fast as the
river client/server is able to consume them.
What changed
============
- Add a condvar to the message buffer to allow waiting for buffer space
to come available when the buffer is full
- Add a closed bit to the message buffer so when a session is shut down,
we have a way of unblocking all the futures that are stuck waiting for
space in the buffer
- Close the message buffer when the session is closed
Test plan
=========
- Added a test which sends `2 * MAX_MESSAGE_BUFFER_SIZE` messages to a
river server. Previously this resulted in an error.
- Added some unit tests for the `MessageBuffer` to ensure backpressure
works and closing works
0 commit comments