Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions tokio/src/time/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ fn internal_interval_at(
/// `MissedTickBehavior` can be used to specify a different behavior for
/// [`Interval`] to exhibit. Each variant represents a different strategy.
///
/// With all tick behaviors, the next tick after a missed tick will always
/// complete immediately.
///
/// Note that because the executor cannot guarantee exact precision with timers,
/// these strategies will only apply when the delay is greater than 5
/// milliseconds.
Expand Down Expand Up @@ -294,12 +297,11 @@ pub enum MissedTickBehavior {
/// When this strategy is used, [`Interval`] schedules the next tick to fire
/// at the next-closest tick that is a multiple of `period` away from
/// `start` (the point where [`Interval`] first ticked). Like [`Burst`], all
/// ticks remain multiples of `period` away from `start`, but unlike
/// [`Burst`], the ticks may not be *one* multiple of `period` away from the
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Just realized that this is most likely a typo and meant to say Delay when I wrote the commit message. If someone can confirm this I can change that rather than removing this section entirely.

/// last tick. Like [`Delay`], the ticks are no longer the same as they
/// would have been if ticks had not been missed, but unlike [`Delay`], and
/// like [`Burst`], the ticks may be shortened to be less than one `period`
/// away from each other.
/// ticks remain multiples of `period` away from `start`. Like [`Delay`],
/// the number of fired ticks are no longer the same as they would have been
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Personally I think rephrasing this as "number of fired ticks" is an improvement compared to just "ticks are no longer the same", especially since a lot of this section talks about duration and not count.

That said, this was mostly a driveby idea I had for rephrasing things, I'm happy to discard if you disagree with this change.

/// if ticks had not been missed, but unlike [`Delay`], and like [`Burst`],
/// the ticks may be shortened to be less than one `period` away from each
/// other.
///
/// This looks something like this:
/// ```text
Expand Down
Loading