Use a tokio interval instead of a sleep in the activity tracker

This commit is contained in:
Quentin Gliech
2025-04-28 09:59:58 +02:00
parent 062d554a6f
commit ed8eec669b
+3 -1
View File
@@ -185,6 +185,8 @@ impl ActivityTracker {
// This guard on the shutdown token is to ensure that if this task crashes for
// any reason, the server will shut down
let _guard = cancellation_token.clone().drop_guard();
let mut interval = tokio::time::interval(interval);
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
loop {
tokio::select! {
@@ -202,7 +204,7 @@ impl ActivityTracker {
}
() = tokio::time::sleep(interval) => {
_ = interval.tick() => {
self.flush().await;
}
}