Add admin button to update repo
This commit is contained in:
parent
6cf7a0b586
commit
4f2b0a0b88
9 changed files with 69 additions and 15 deletions
|
|
@ -4,14 +4,17 @@ mod fetch;
|
|||
mod queue;
|
||||
mod repo;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use super::{Repo, Server};
|
||||
|
||||
pub(super) async fn run(server: Server, repo: Repo) {
|
||||
pub(super) async fn run(server: Server, repo: Repo, mut recurring_rx: mpsc::UnboundedReceiver<()>) {
|
||||
loop {
|
||||
fetch::update(server.config, repo.clone()).await;
|
||||
repo::update(&server.db, repo.clone()).await;
|
||||
queue::update(&server.db).await;
|
||||
|
||||
tokio::time::sleep(server.config.repo_update).await;
|
||||
let _ = tokio::time::timeout(server.config.repo_update, recurring_rx.recv()).await;
|
||||
while let Ok(()) = recurring_rx.try_recv() {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue