diff --git a/src/database/key_value/rooms/edus/presence.rs b/src/database/key_value/rooms/edus/presence.rs index 5c49b95a..7732983a 100644 --- a/src/database/key_value/rooms/edus/presence.rs +++ b/src/database/key_value/rooms/edus/presence.rs @@ -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()); diff --git a/src/service/rooms/edus/presence/mod.rs b/src/service/rooms/edus/presence/mod.rs index 38e0f022..0f3421c9 100644 --- a/src/service/rooms/edus/presence/mod.rs +++ b/src/service/rooms/edus/presence/mod.rs @@ -114,18 +114,10 @@ impl Service { &self, timer_receiver: mpsc::UnboundedReceiver, ) -> 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() }