don't immediately run fetcher a second time on startup

This commit is contained in:
xenofem 2022-04-16 00:04:41 -04:00
parent 1f7e5ee5ca
commit 774f3195de

View file

@ -50,10 +50,10 @@ async fn start_updater() -> Result<web::Data<AppState>, Error> {
std::thread::spawn(move || { std::thread::spawn(move || {
actix_web::rt::System::new().block_on(async { actix_web::rt::System::new().block_on(async {
loop { loop {
actix_web::rt::time::sleep(*UPDATE_INTERVAL).await;
if let Err(e) = try_update(&state_copy, &mut fetcher).await { if let Err(e) = try_update(&state_copy, &mut fetcher).await {
eprintln!("Error updating data: {:#?}", e); eprintln!("Error updating data: {:#?}", e);
} }
actix_web::rt::time::sleep(*UPDATE_INTERVAL).await;
} }
}); });
}); });