File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,18 @@ async fn cron_enqueue_jobs(site_ctxt: &Arc<SiteCtxt>) {
4141
4242/// Entry point for the cron
4343pub async fn cron_main ( site_ctxt : Arc < RwLock < Option < Arc < SiteCtxt > > > > , seconds : u64 ) {
44- let ctxt = site_ctxt. clone ( ) ;
4544 let mut interval = time:: interval ( Duration :: from_secs ( seconds) ) ;
45+ let ctxt = site_ctxt. clone ( ) ;
46+
47+ loop {
48+ interval. tick ( ) . await ;
4649
47- if let Some ( ctxt_clone) = {
48- let guard = ctxt. read ( ) ;
49- guard. as_ref ( ) . cloned ( )
50- } {
51- loop {
50+ if let Some ( ctxt_clone) = {
51+ let guard = ctxt. read ( ) ;
52+ guard. as_ref ( ) . cloned ( )
53+ } {
5254 cron_enqueue_jobs ( & ctxt_clone) . await ;
53- interval. tick ( ) . await ;
54- println ! ( "Cron job executed at: {:?}" , std:: time:: SystemTime :: now( ) ) ;
55+ log:: info!( "Cron job executed at: {:?}" , std:: time:: SystemTime :: now( ) ) ;
5556 }
5657 }
5758}
You can’t perform that action at this time.
0 commit comments