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 <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2024-07-18 11:30:11 +03:00
parent f713e4aa6a
commit 0bbfebc80d
+6 -2
View File
@@ -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);
})
}