-
Notifications
You must be signed in to change notification settings - Fork 26
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
Capacity change + overflow mode #1
Conversation
Converting it into a draft as this is broken for awaiting receivers. I'm working on it.. |
Gah, the calculations/algorithm required here turned out to be quite a pickle. I have pushed my WIP work here and with the last commit the existing and the newly added test succeed now but testing it against zbus, reveals it's still broken as messages just get lost. So I could really use some help here or at least a second pair of eyes. |
9b34586
to
6459670
Compare
The WIP work I just pushed seems to work fine. There is still at least one issue (if latest messages are dropped on capacity change, receivers are wrongly adjusted) and need to optimize the code a bit but hopefully the hard part is done and I can fix this today. |
If new capacity is less then channel length, oldest messages are dropped.
When enabled, broadcasting a message to a full channel always succeeds, by removal of the oldest message from the channel. This is an API break.
I think I got it working, based on all the testing I can give it. If anyone else can have a look and tell me if this can be improved, please do let me know. |
All my testing has been green so far, so I'm merging this already. We can always fix things later if needed. |
This PR adds:
Add a notion of message priority (used by the other two API). In the end, this will just complicate things and I don't see people wanting to delete newer messages on channel shrinkSender::{try_broadcast, broadcast}
caller.