From bacc736364187b893c19f73167c3f733516c7c76 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Sun, 14 Aug 2022 22:48:09 +0200 Subject: [PATCH] Use MissedTickBehavior::Delay for updating crates.io-index (#161) --- src/utils/index.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/index.rs b/src/utils/index.rs index a698821..011adac 100644 --- a/src/utils/index.rs +++ b/src/utils/index.rs @@ -8,7 +8,7 @@ use crates_index::Crate; use crates_index::Index; use slog::{error, Logger}; use tokio::task::spawn_blocking; -use tokio::time; +use tokio::time::{self, MissedTickBehavior}; #[derive(Clone)] pub struct ManagedIndex { @@ -31,6 +31,7 @@ impl ManagedIndex { pub async fn refresh_at_interval(&self, update_interval: Duration) { let mut update_interval = time::interval(update_interval); + update_interval.set_missed_tick_behavior(MissedTickBehavior::Delay); loop { if let Err(e) = self.refresh().await {