fix(presence): check for allow_presence only after services are available
This commit is contained in:
parent
46676267df
commit
8257d0447a
2 changed files with 8 additions and 8 deletions
|
@ -210,6 +210,10 @@ impl service::rooms::edus::presence::Data for KeyValueDatabase {
|
||||||
// Wait for services to be created
|
// Wait for services to be created
|
||||||
sleep(Duration::from_secs(15)).await;
|
sleep(Duration::from_secs(15)).await;
|
||||||
|
|
||||||
|
if !services().globals.allow_presence() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let idle_timeout = Duration::from_secs(services().globals.presence_idle_timeout());
|
let idle_timeout = Duration::from_secs(services().globals.presence_idle_timeout());
|
||||||
let offline_timeout =
|
let offline_timeout =
|
||||||
Duration::from_secs(services().globals.presence_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
|
// Wait for services to be created
|
||||||
sleep(Duration::from_secs(15)).await;
|
sleep(Duration::from_secs(15)).await;
|
||||||
|
|
||||||
|
if !services().globals.allow_presence() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let period = Duration::from_secs(services().globals.presence_cleanup_period());
|
let period = Duration::from_secs(services().globals.presence_cleanup_period());
|
||||||
let age_limit = Duration::from_secs(services().globals.presence_cleanup_limit());
|
let age_limit = Duration::from_secs(services().globals.presence_cleanup_limit());
|
||||||
|
|
||||||
|
|
|
@ -114,18 +114,10 @@ impl Service {
|
||||||
&self,
|
&self,
|
||||||
timer_receiver: mpsc::UnboundedReceiver<OwnedUserId>,
|
timer_receiver: mpsc::UnboundedReceiver<OwnedUserId>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if !services().globals.allow_presence() {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
self.db.presence_maintain(timer_receiver)
|
self.db.presence_maintain(timer_receiver)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn presence_cleanup(&self) -> Result<()> {
|
fn presence_cleanup(&self) -> Result<()> {
|
||||||
if !services().globals.allow_presence() {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
self.db.presence_cleanup()
|
self.db.presence_cleanup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue