@@ -22,29 +22,29 @@ pub async fn start_cron_scheduler(state: Arc<AppState>) {
2222
2323 loop_count = loop_count. wrapping_add ( 1 ) ;
2424
25- if loop_count % 60 == 0 {
26- if let Some ( ref infinite_mem) = state. infinite_mem {
27- tracing :: debug! ( "Cron: running infinite memory compression..." ) ;
28- let mem = Arc :: clone ( infinite_mem ) ;
29- state . background_tasks . lock ( ) . await . spawn ( async move {
30- match mem . run_full_compression ( ) . await {
31- Ok ( ( five_min , hour , day ) ) => {
32- if five_min > 0 || hour > 0 || day > 0 {
33- tracing :: info! (
34- "Cron: created {} 5min, {} hour, {} day summaries" ,
35- five_min ,
36- hour ,
37- day ,
38- ) ;
39- }
25+ if loop_count. is_multiple_of ( 60 )
26+ && let Some ( ref infinite_mem) = state. infinite_mem
27+ {
28+ tracing :: debug! ( "Cron: running infinite memory compression..." ) ;
29+ let mem = Arc :: clone ( infinite_mem ) ;
30+ state . background_tasks . lock ( ) . await . spawn ( async move {
31+ match mem . run_full_compression ( ) . await {
32+ Ok ( ( five_min, hour, day) ) => {
33+ if five_min > 0 || hour > 0 || day > 0 {
34+ tracing :: info! (
35+ "Cron: created {} 5min, {} hour, {} day summaries" ,
36+ five_min ,
37+ hour ,
38+ day ,
39+ ) ;
4040 }
41- Err ( e) => tracing:: warn!( "Cron: infinite memory error: {e:?}" ) ,
4241 }
43- } ) ;
44- }
42+ Err ( e) => tracing:: warn!( "Cron: infinite memory error: {e:?}" ) ,
43+ }
44+ } ) ;
4545 }
4646
47- if loop_count % 180 == 0 {
47+ if loop_count. is_multiple_of ( 180 ) {
4848 tracing:: debug!( "Cron: running embedding backfill..." ) ;
4949 let state_clone = Arc :: clone ( & state) ;
5050 state. background_tasks . lock ( ) . await . spawn ( async move {
@@ -58,7 +58,7 @@ pub async fn start_cron_scheduler(state: Arc<AppState>) {
5858 } ) ;
5959 }
6060
61- if loop_count % 360 == 0 {
61+ if loop_count. is_multiple_of ( 360 ) {
6262 let state_clone = Arc :: clone ( & state) ;
6363 state. background_tasks . lock ( ) . await . spawn ( async move {
6464 match state_clone. observation_service . run_dedup_sweep ( ) . await {
@@ -71,7 +71,7 @@ pub async fn start_cron_scheduler(state: Arc<AppState>) {
7171 } ) ;
7272 }
7373
74- if loop_count % 720 == 0 {
74+ if loop_count. is_multiple_of ( 720 ) {
7575 let state_clone = Arc :: clone ( & state) ;
7676 state. background_tasks . lock ( ) . await . spawn ( async move {
7777 if let Err ( e) = state_clone
@@ -84,7 +84,7 @@ pub async fn start_cron_scheduler(state: Arc<AppState>) {
8484 } ) ;
8585 }
8686
87- if loop_count % 17280 == 0 {
87+ if loop_count. is_multiple_of ( 17280 ) {
8888 let ttl_secs = state. config . dlq_ttl_secs ( ) ;
8989 let state_clone = Arc :: clone ( & state) ;
9090 state. background_tasks . lock ( ) . await . spawn ( async move {
@@ -102,7 +102,7 @@ pub async fn start_cron_scheduler(state: Arc<AppState>) {
102102 } ) ;
103103 }
104104
105- if loop_count % 2160 == 0 {
105+ if loop_count. is_multiple_of ( 2160 ) {
106106 let state_clone = Arc :: clone ( & state) ;
107107 state. background_tasks . lock ( ) . await . spawn ( async move {
108108 match state_clone
@@ -125,7 +125,7 @@ pub async fn start_cron_scheduler(state: Arc<AppState>) {
125125 } ) ;
126126 }
127127
128- if loop_count % 360 == 0 {
128+ if loop_count. is_multiple_of ( 360 ) {
129129 let state_clone = Arc :: clone ( & state) ;
130130 state. background_tasks . lock ( ) . await . spawn ( async move {
131131 match state_clone
0 commit comments