Add back allow_check_for_updates
Signed-off-by: morguldir <morguldir@protonmail.com>
This commit is contained in:
parent
cf9b72ce3f
commit
a41e63b40e
1 changed files with 8 additions and 2 deletions
|
@ -1,13 +1,13 @@
|
||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
use async_trait::async_trait;
|
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 database::Map;
|
||||||
use ruma::events::room::message::RoomMessageEventContent;
|
use ruma::events::room::message::RoomMessageEventContent;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use tokio::{sync::Notify, time::interval};
|
use tokio::{sync::Notify, time::interval};
|
||||||
|
|
||||||
use crate::{admin, client, Dep};
|
use crate::{admin, client, globals, Dep};
|
||||||
|
|
||||||
pub struct Service {
|
pub struct Service {
|
||||||
services: Services,
|
services: Services,
|
||||||
|
@ -19,6 +19,7 @@ pub struct Service {
|
||||||
struct Services {
|
struct Services {
|
||||||
admin: Dep<admin::Service>,
|
admin: Dep<admin::Service>,
|
||||||
client: Dep<client::Service>,
|
client: Dep<client::Service>,
|
||||||
|
globals: Dep<globals::Service>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -42,6 +43,7 @@ impl crate::Service for Service {
|
||||||
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
|
||||||
Ok(Arc::new(Self {
|
Ok(Arc::new(Self {
|
||||||
services: Services {
|
services: Services {
|
||||||
|
globals: args.depend::<globals::Service>("globals"),
|
||||||
admin: args.depend::<admin::Service>("admin"),
|
admin: args.depend::<admin::Service>("admin"),
|
||||||
client: args.depend::<client::Service>("client"),
|
client: args.depend::<client::Service>("client"),
|
||||||
},
|
},
|
||||||
|
@ -52,6 +54,10 @@ impl crate::Service for Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn worker(self: Arc<Self>) -> Result<()> {
|
async fn worker(self: Arc<Self>) -> Result<()> {
|
||||||
|
if !self.services.globals.allow_check_for_updates() {
|
||||||
|
debug!("Disabling update check");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let mut i = interval(self.interval);
|
let mut i = interval(self.interval);
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
|
|
Loading…
Add table
Reference in a new issue