fix infinite loop lint

this is actually better to do CPU-wise anyways

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-23 12:34:28 -04:00 committed by June
parent 8dad4461b4
commit a7e6fe8b60

View file

@ -1007,7 +1007,7 @@ impl KeyValueDatabase {
Self::start_cleanup_task().await; Self::start_cleanup_task().await;
if services().globals.allow_check_for_updates() { if services().globals.allow_check_for_updates() {
Self::start_check_for_updates_task(); Self::start_check_for_updates_task().await;
} }
if services().globals.allow_local_presence() { if services().globals.allow_local_presence() {
Self::start_presence_handler(presence_receiver).await; Self::start_presence_handler(presence_receiver).await;
@ -1027,12 +1027,19 @@ impl KeyValueDatabase {
} }
#[tracing::instrument] #[tracing::instrument]
fn start_check_for_updates_task() { async fn start_check_for_updates_task() {
let timer_interval = Duration::from_secs(7200); // 2 hours
tokio::spawn(async move { tokio::spawn(async move {
let timer_interval = Duration::from_secs(60 * 60);
let mut i = interval(timer_interval); let mut i = interval(timer_interval);
loop { loop {
i.tick().await; tokio::select! {
_ = i.tick() => {
debug!(target: "start_check_for_updates_task", "Timer ticked");
},
}
let _ = Self::try_handle_updates().await; let _ = Self::try_handle_updates().await;
} }
}); });