Skip to content

Commit 256f124

Browse files
committed
Put the interval delay after the function calls so the cron job happens immediately
1 parent 03debdc commit 256f124

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

site/src/job_queue/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ pub async fn cron_main(site_ctxt: Arc<RwLock<Option<Arc<SiteCtxt>>>>, seconds: u
289289
let ctxt = site_ctxt.clone();
290290

291291
loop {
292-
interval.tick().await;
293-
294292
if let Some(ctxt_clone) = {
295293
let guard = ctxt.read();
296294
guard.as_ref().cloned()
@@ -300,6 +298,8 @@ pub async fn cron_main(site_ctxt: Arc<RwLock<Option<Arc<SiteCtxt>>>>, seconds: u
300298
Err(e) => log::error!("Cron job failed to execute: {e:?}"),
301299
}
302300
}
301+
302+
interval.tick().await;
303303
}
304304
}
305305

0 commit comments

Comments
 (0)