Skip to content
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

On same deadline, items queued first have priority #205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amcandio
Copy link

@amcandio amcandio commented Jul 31, 2024

When multiple are registered at the same time, those registered first should have priority to make scheduling behavior easier to predict. I don't think this should be added as documented behavior to prevent users from depending on it.

Once nice to have follow up would be to start supporting custom prioritization as tie-breaker so users can define their own to handle tie-breaking. Right now users depend on tweaking expire timestamps to get same effect, which is not clean.

@notgull
Copy link
Member

notgull commented Aug 10, 2024

@amcandio Please rebase on master to fix the CI

@amcandio
Copy link
Author

@notgull rebased!

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.22%. Comparing base (5ba1370) to head (10465dc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #205      +/-   ##
==========================================
+ Coverage   85.44%   86.22%   +0.77%     
==========================================
  Files          13       15       +2     
  Lines        1876     2069     +193     
==========================================
+ Hits         1603     1784     +181     
- Misses        273      285      +12     
Flag Coverage Δ
macos-latest 85.50% <100.00%> (?)
ubuntu-latest 85.82% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amcandio
Copy link
Author

@notgull any update on this?

Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I was distracted.

@@ -278,8 +278,11 @@ impl TimerWheel {
impl std::cmp::Ord for TimeoutData {
#[inline]
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
// earlier values have priority
self.deadline.cmp(&other.deadline).reverse()
// earlier values have priority, on same deadline items queued first have priority
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use proper capitalization and punctuation for comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants