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>) {
41
41
42
42
/// Entry point for the cron
43
43
pub async fn cron_main ( site_ctxt : Arc < RwLock < Option < Arc < SiteCtxt > > > > , seconds : u64 ) {
44
- let ctxt = site_ctxt. clone ( ) ;
45
44
let mut interval = time:: interval ( Duration :: from_secs ( seconds) ) ;
45
+ let ctxt = site_ctxt. clone ( ) ;
46
+
47
+ loop {
48
+ interval. tick ( ) . await ;
46
49
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
+ } {
52
54
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( ) ) ;
55
56
}
56
57
}
57
58
}
You can’t perform that action at this time.
0 commit comments