fix(presence): check for allow_presence only after services are available

This commit is contained in:
Jakub Kubík 2022-12-07 18:43:27 +01:00
parent 46676267df
commit 8257d0447a
No known key found for this signature in database
GPG key ID: D3A0D5D60F3A173F
2 changed files with 8 additions and 8 deletions

View file

@ -210,6 +210,10 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
// Wait for services to be created
sleep(Duration::from_secs(15)).await;
if !services().globals.allow_presence() {
return;
}
let idle_timeout = Duration::from_secs(services().globals.presence_idle_timeout());
let offline_timeout =
Duration::from_secs(services().globals.presence_offline_timeout());
@ -296,6 +300,10 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
// Wait for services to be created
sleep(Duration::from_secs(15)).await;
if !services().globals.allow_presence() {
return;
}
let period = Duration::from_secs(services().globals.presence_cleanup_period());
let age_limit = Duration::from_secs(services().globals.presence_cleanup_limit());

View file

@ -114,18 +114,10 @@ impl Service {
&self,
timer_receiver: mpsc::UnboundedReceiver<OwnedUserId>,
) -> Result<()> {
if !services().globals.allow_presence() {
return Ok(());
}
self.db.presence_maintain(timer_receiver)
}
fn presence_cleanup(&self) -> Result<()> {
if !services().globals.allow_presence() {
return Ok(());
}
self.db.presence_cleanup()
}