only sleep for 1 second before first health check

This commit is contained in:
Aiden McClelland
2021-12-09 18:15:29 -07:00
committed by Aiden McClelland
parent b29060e0af
commit 7df953d5fb

View File

@@ -264,8 +264,8 @@ async fn run_main(
.commit_health_check_results .commit_health_check_results
.store(true, Ordering::SeqCst); .store(true, Ordering::SeqCst);
let health = async { let health = async {
tokio::time::sleep(Duration::from_secs(1)).await; // only sleep for 1 second before first health check
loop { loop {
tokio::time::sleep(Duration::from_secs(HEALTH_CHECK_COOLDOWN_SECONDS)).await;
let mut db = state.ctx.db.handle(); let mut db = state.ctx.db.handle();
if let Err(e) = health::check( if let Err(e) = health::check(
&state.ctx, &state.ctx,
@@ -282,6 +282,7 @@ async fn run_main(
); );
tracing::debug!("{:?}", e); tracing::debug!("{:?}", e);
} }
tokio::time::sleep(Duration::from_secs(HEALTH_CHECK_COOLDOWN_SECONDS)).await;
} }
}; };
let _ = state let _ = state