From a41e63b40e83a82991eac4f48cbf2e3fea711c19 Mon Sep 17 00:00:00 2001 From: morguldir Date: Thu, 15 Aug 2024 18:39:23 +0200 Subject: [PATCH] Add back allow_check_for_updates Signed-off-by: morguldir --- src/service/updates/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/service/updates/mod.rs b/src/service/updates/mod.rs index f89471cd..3c69b243 100644 --- a/src/service/updates/mod.rs +++ b/src/service/updates/mod.rs @@ -1,13 +1,13 @@ use std::{sync::Arc, time::Duration}; use async_trait::async_trait; -use conduit::{err, info, utils, warn, Error, Result}; +use conduit::{debug, err, info, utils, warn, Error, Result}; use database::Map; use ruma::events::room::message::RoomMessageEventContent; use serde::Deserialize; use tokio::{sync::Notify, time::interval}; -use crate::{admin, client, Dep}; +use crate::{admin, client, globals, Dep}; pub struct Service { services: Services, @@ -19,6 +19,7 @@ pub struct Service { struct Services { admin: Dep, client: Dep, + globals: Dep, } #[derive(Deserialize)] @@ -42,6 +43,7 @@ impl crate::Service for Service { fn build(args: crate::Args<'_>) -> Result> { Ok(Arc::new(Self { services: Services { + globals: args.depend::("globals"), admin: args.depend::("admin"), client: args.depend::("client"), }, @@ -52,6 +54,10 @@ impl crate::Service for Service { } async fn worker(self: Arc) -> Result<()> { + if !self.services.globals.allow_check_for_updates() { + debug!("Disabling update check"); + return Ok(()); + } let mut i = interval(self.interval); loop { tokio::select! {