Skip to content

Conversation

@AhmedSoliman
Copy link
Contributor

@AhmedSoliman AhmedSoliman commented Nov 24, 2025

This changeset makes sure that we have a reliable datum point that's shared between the delayed queue internal timer wheel and the scheduler.
Additionally, it ensures that the scheduler can create Instant values that are synchronized with the datum point acquired from UniqueTimestamp.

This fixes the issue introduced in changeset 6e65909 where we would become eligible slightly before the actual eligibility time, causing supurious rescheduling.


Stack created with Sapling. Best reviewed with ReviewStack.

@AhmedSoliman AhmedSoliman force-pushed the pr4055 branch 2 times, most recently from 8095323 to d494555 Compare November 24, 2025 10:47
@AhmedSoliman AhmedSoliman marked this pull request as ready for review November 24, 2025 10:47
…nized with eligibility_at

This changeset makes sure that we have a reliable datum point that's shared between the delayed queue internal timer wheel and the scheduler.
Additionally, it ensures that the scheduler can create `Instant` values that are synchronized with the datum point acquired from UniqueTimestamp.

This fixes the issue introduced in changeset 6e65909 where we would become eligible slightly before the actual eligibility time, causing supurious rescheduling.
@github-actions
Copy link

github-actions bot commented Nov 24, 2025

Test Results

  7 files  ±0    7 suites  ±0   3m 19s ⏱️ +9s
 47 tests ±0   47 ✅ ±0  0 💤 ±0  0 ❌ ±0 
200 runs  ±0  200 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 914cac6. ± Comparison against base commit c05c1de.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

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

Thanks a lot for fixing the handling of delayed invocations @AhmedSoliman. The changes look good to me. I had a question about the need to set the start value of the DelayQueue explicitly.

Comment on lines +106 to +109
// Makes sure we use the same clock datum for the internal timer wheel and for our
// own eligibility checks.
let start = datum.origin_instant();
let delayed_eligibility = DelayQueue::new(start);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't fully understand why it is strictly required that the DelayQueue has the same start as the datum.origin_instant(). It seems as if the DelayQueue uses the start value for calculating offsets for internal purposes.

Isn't it enough that we are using the same clock (Tokio's) and insert_at and reset_at with concrete instants instead of durations to make the scheduling work reliably? Or differently asked, what would not work if we didn't set the start value of the DelayQueue.

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.

3 participants