mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-09 14:06:42 +02:00
database: remove unnecessary async and select!{}
This commit is contained in:
parent
2e2b3793ca
commit
69081a49aa
1 changed files with 5 additions and 9 deletions
|
@ -388,9 +388,9 @@ impl KeyValueDatabase {
|
||||||
services().presence.start_handler();
|
services().presence.start_handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::start_cleanup_task().await;
|
Self::start_cleanup_task();
|
||||||
if services().globals.allow_check_for_updates() {
|
if services().globals.allow_check_for_updates() {
|
||||||
Self::start_check_for_updates_task().await;
|
Self::start_check_for_updates_task();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -422,18 +422,14 @@ impl KeyValueDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument]
|
#[tracing::instrument]
|
||||||
async fn start_check_for_updates_task() {
|
fn start_check_for_updates_task() {
|
||||||
let timer_interval = Duration::from_secs(7200); // 2 hours
|
let timer_interval = Duration::from_secs(7200); // 2 hours
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut i = interval(timer_interval);
|
let mut i = interval(timer_interval);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
i.tick().await;
|
||||||
_ = i.tick() => {
|
|
||||||
debug!(target: "start_check_for_updates_task", "Timer ticked");
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = Self::try_handle_updates().await;
|
_ = Self::try_handle_updates().await;
|
||||||
}
|
}
|
||||||
|
@ -476,7 +472,7 @@ impl KeyValueDatabase {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument]
|
#[tracing::instrument]
|
||||||
async fn start_cleanup_task() {
|
fn start_cleanup_task() {
|
||||||
let timer_interval = Duration::from_secs(u64::from(services().globals.config.cleanup_second_interval));
|
let timer_interval = Duration::from_secs(u64::from(services().globals.config.cleanup_second_interval));
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
|
|
Loading…
Add table
Reference in a new issue