diff --git a/src/workers.rs b/src/workers.rs index b4ae437..fa065c3 100644 --- a/src/workers.rs +++ b/src/workers.rs @@ -70,10 +70,10 @@ pub async fn refresh_user_data( classifier: Arc>, ) { loop { - tokio::time::sleep(FORGEJO_POLL_DELAY.mul_f32(0.1)).await; if let Err(e) = try_refresh_user_data(&forge, db.clone(), classifier.clone()).await { eprintln!("Error refreshing user data: {:?}", e); } + tokio::time::sleep(FORGEJO_POLL_DELAY.mul_f32(0.1)).await; } } @@ -91,8 +91,6 @@ async fn try_purge_account(forge: &Forgejo, login: &str) -> anyhow::Result<()> { pub async fn purge_spammer_accounts(forge: Arc, db: Arc>) { loop { - tokio::time::sleep(std::time::Duration::from_secs(3600)).await; - let mut classified_users = Vec::new(); { let db = &db.lock().unwrap(); @@ -121,5 +119,7 @@ pub async fn purge_spammer_accounts(forge: Arc, db: Arc>) { } } } + + tokio::time::sleep(std::time::Duration::from_secs(3600)).await; } }