From 0bbfebc80da0796f92456f01f814e19886c4ef39 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 18 Jul 2024 11:30:11 +0300 Subject: [PATCH] refactor(src/pages.rs): use a Duration instead of plain integer Also, log the duration until the next update, to help impatient node operators to know what's going on. Signed-off-by: Lars Wirzenius --- src/pages.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages.rs b/src/pages.rs index d1c45760..1d5ad8a6 100644 --- a/src/pages.rs +++ b/src/pages.rs @@ -32,7 +32,7 @@ use crate::{ const CSS: &str = include_str!("radicle-ci.css"); const REFERESH_INTERVAL: &str = "300"; -const UPDATE_INTERVAL: u64 = 60; +const UPDATE_INTERVAL: Duration = Duration::from_secs(60); /// All possible errors returned from the status page module. #[derive(Debug, thiserror::Error)] @@ -503,7 +503,11 @@ impl StatusPage { if once { return Ok(()); } - sleep(Duration::from_secs(UPDATE_INTERVAL)); + info!( + "wait about {} seconds to update HTML report pages again", + UPDATE_INTERVAL.as_secs() + ); + sleep(UPDATE_INTERVAL); }) }