-
Notifications
You must be signed in to change notification settings - Fork 220
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
Fix WheelTimer implementation that can expired timeout early #17850
Fix WheelTimer implementation that can expired timeout early #17850
Conversation
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.
Nice catch! Makes sense after going through the motions
Strictly just needs the changelog fix. Updating tests also seems like a good change but we can always do that in a follow-up PR.
Co-authored-by: Eric Eastwood <[email protected]>
1acb2cc
to
511f88e
Compare
I fixed changelog and refactored wheel tests to use strings intead of objects |
11f6cea
to
e7c670d
Compare
Thanks for the contribution @udovichenkoAlexander 🐄 |
When entries insert in the end of timer queue, then unnecessary entry inserted (with duplicated key).
This can lead to some timeouts expired early and consume memory.
This can be checked with following test (to this file)
Look at the entries after obj2 insert:
gaps and duplicates cause errors when search Entry to insert in the middle of queue:
self.entries[max(min_key, then_key) - min_key].elements.add(obj)
This Pull request fix this with some minor refactoring (remove
current_tick
unused variable) and add this test case to unit tests.