From 6ff3db09c5ab040a0dc77a5c4d4215e76f636f34 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Fri, 28 Mar 2025 15:03:54 -0700 Subject: [PATCH] Fix waiting function --- tegakituesday/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tegakituesday/src/main.rs b/tegakituesday/src/main.rs index 2d134ba..e695fa8 100644 --- a/tegakituesday/src/main.rs +++ b/tegakituesday/src/main.rs @@ -7,7 +7,7 @@ use rocket::{ fs::{relative, FileServer}, Ignite, Rocket }; use rocket_dyn_templates::{tera, Template}; -use tokio::time; +use tokio::time::sleep; use std::{collections::HashMap, env, time::Duration}; use lazy_static::lazy_static; @@ -63,9 +63,9 @@ async fn main() { }, None => { tokio::task::spawn(async { - let mut interval = time::interval(Duration::from_millis(60 * 60 * 1000)); // every hour + const INTERVAL: Duration = Duration::from_millis(60 * 60 * 1000); // every hour loop { - interval.tick().await; + sleep(INTERVAL).await; if let Err(err) = DATABASE.refresh_users(&HTTP).await { error!("{:?}", err); }