fix(presence): move sleep in presence cleanup

This commit is contained in:
Jakub Kubík 2022-11-21 22:03:50 +01:00
parent 230f09f8f7
commit 63ac118d11
No known key found for this signature in database
GPG key ID: D3A0D5D60F3A173F
2 changed files with 3 additions and 2 deletions

View file

@ -276,7 +276,7 @@ fn default_presence_offline_timeout() -> u64 {
}
fn default_presence_cleanup_period() -> u64 {
24 * 60 * 60
1 * 60 * 60
}
fn default_presence_cleanup_limit() -> u64 {

View file

@ -306,6 +306,8 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
tokio::spawn(async move {
loop {
sleep(period).await;
let mut removed_events: u64 = 0;
let age_limit_curr =
millis_since_unix_epoch().saturating_sub(age_limit.as_millis() as u64);
@ -350,7 +352,6 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
}
info!("Cleaned up {removed_events} stale presence events!");
sleep(period).await;
}
});