From e4697362783ea9ba102028c23b7bd9c29b205ef7 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 29 Jul 2022 15:00:44 +0800 Subject: [PATCH] stagger the flush timing a little bit noticed it's hitting exactly when NTP updates because it also happens on a 24-hour schedule, staggering a bit to try and keep everything from hitting exactly at the same time once a day. --- services/pddb/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index d489e43f7..d6852bcdf 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -534,7 +534,7 @@ fn wrapped_main() -> ! { let tt = ticktimer_server::Ticktimer::new().unwrap(); let mut flush_interval = 0; const ARBITRARY_INTERVAL_MS: usize = 12_513; - const PERIODIC_FLUSH_MS: usize = 86_400_000; // one day + const PERIODIC_FLUSH_MS: usize = 1000 * 60 * 60 * 18 - 5555; // every 18 hours less ~5 seconds to try and stagger the process off of other periodics loop { tt.sleep_ms(ARBITRARY_INTERVAL_MS).unwrap(); // arbitrary interval, but trying to avoid "round" numbers of seconds to interleave periodic tasks flush_interval += ARBITRARY_INTERVAL_MS;