Fix waiting function
This commit is contained in:
parent
0040dcf6df
commit
6ff3db09c5
1 changed files with 3 additions and 3 deletions
|
@ -7,7 +7,7 @@ use rocket::{
|
||||||
fs::{relative, FileServer}, Ignite, Rocket
|
fs::{relative, FileServer}, Ignite, Rocket
|
||||||
};
|
};
|
||||||
use rocket_dyn_templates::{tera, Template};
|
use rocket_dyn_templates::{tera, Template};
|
||||||
use tokio::time;
|
use tokio::time::sleep;
|
||||||
use std::{collections::HashMap, env, time::Duration};
|
use std::{collections::HashMap, env, time::Duration};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ async fn main() {
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
tokio::task::spawn(async {
|
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 {
|
loop {
|
||||||
interval.tick().await;
|
sleep(INTERVAL).await;
|
||||||
if let Err(err) = DATABASE.refresh_users(&HTTP).await {
|
if let Err(err) = DATABASE.refresh_users(&HTTP).await {
|
||||||
error!("{:?}", err);
|
error!("{:?}", err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue