From 8ac673b8cb76b009608ebabc4635ea9adde621a1 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Sun, 12 May 2024 22:00:14 +0100 Subject: [PATCH] fixup! Use an interval to drive schedule updates in announcer --- client/src/announcer/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/announcer/mod.rs b/client/src/announcer/mod.rs index a087925..30604a6 100644 --- a/client/src/announcer/mod.rs +++ b/client/src/announcer/mod.rs @@ -74,7 +74,9 @@ pub struct Announcer { impl Announcer { pub async fn new(settings: AnnouncerSettings, client: Client) -> crate::Result { let schedule = self::utils::get_sorted_schedule(&client).await?; - let schedule_update_interval = tokio::time::interval(settings.schedule_refresh); + + let mut schedule_update_interval = tokio::time::interval(settings.schedule_refresh); + schedule_update_interval.reset(); Ok(Self { settings, @@ -124,7 +126,7 @@ impl Announcer { return Ok(AnnouncerPollResult::ScheduleRefreshed(changes)) }, Err(e) => { - warn!("Failed to update schedule {e}") + warn!("Failed to update schedule: {e}") }, } }