From 3a2147d50fc3bdf03810b92c36b01215432866ae Mon Sep 17 00:00:00 2001 From: _ <> Date: Sun, 18 Jul 2021 17:40:07 +0000 Subject: [PATCH] use `MissedTickBehavior::Skip` on all intervals --- crates/ptth_relay/src/lib.rs | 2 ++ crates/ptth_server/src/file_server/metrics.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/crates/ptth_relay/src/lib.rs b/crates/ptth_relay/src/lib.rs index 0c69229..e5e8a73 100644 --- a/crates/ptth_relay/src/lib.rs +++ b/crates/ptth_relay/src/lib.rs @@ -490,6 +490,7 @@ async fn handle_endless_source (gib: usize, throttle: Option ) }; let mut interval = tokio::time::interval (Duration::from_millis (1000)); + interval.set_missed_tick_behavior (tokio::time::MissedTickBehavior::Skip); let mut blocks_sent = 0; while blocks_sent < num_blocks { @@ -771,6 +772,7 @@ pub async fn run_relay ( let state_2 = state.clone (); tokio::spawn (async move { let mut reload_interval = tokio::time::interval (Duration::from_secs (60)); + reload_interval.set_missed_tick_behavior (tokio::time::MissedTickBehavior::Skip); loop { reload_interval.tick ().await; diff --git a/crates/ptth_server/src/file_server/metrics.rs b/crates/ptth_server/src/file_server/metrics.rs index 062ad1e..2637c65 100644 --- a/crates/ptth_server/src/file_server/metrics.rs +++ b/crates/ptth_server/src/file_server/metrics.rs @@ -106,6 +106,7 @@ impl Interval { } let mut interval = tokio::time::interval (Duration::from_secs (60)); + interval.set_missed_tick_behavior (tokio::time::MissedTickBehavior::Skip); let mut counter = 0_u64;