Skip to content

Commit

Permalink
fix: skip missed tickets in interval provider
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger committed Sep 15, 2024
1 parent 51a58df commit 6decc2e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/desktop/src/providers/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ macro_rules! impl_interval_provider {
std::time::Duration::from_millis(self.refresh_interval_ms()),
);

// Skip missed ticks when the interval runs. This prevents a burst
// of backlogged ticks after a delay.
interval
.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);

loop {
interval.tick().await;

Expand Down

0 comments on commit 6decc2e

Please sign in to comment.