show waterlevel for the next days #466

Merged
philipp merged 39 commits from show-waterlevel into main 2024-05-16 21:32:24 +02:00
Showing only changes of commit 2189b082c0 - Show all commits

View File

@ -3,7 +3,7 @@ mod waterlevel;
use std::time::Duration; use std::time::Duration;
use job_scheduler_ng::{Job, JobScheduler}; use job_scheduler_ng::{Job, JobScheduler};
use rocket::tokio::{self, task}; use rocket::tokio::{self, task, time};
use sqlx::SqlitePool; use sqlx::SqlitePool;
pub fn schedule(db: &SqlitePool) { pub fn schedule(db: &SqlitePool) {
@ -26,9 +26,10 @@ pub fn schedule(db: &SqlitePool) {
}); });
})); }));
let mut interval = time::interval(Duration::from_secs(60));
loop { loop {
sched.tick(); sched.tick();
std::thread::sleep(Duration::from_secs(60)); interval.tick().await;
} }
}); });
} }