Switch from tracing to log crate

This commit is contained in:
Joscha 2023-08-17 03:09:24 +02:00
parent 1faf42bd82
commit f12da915a9
16 changed files with 149 additions and 202 deletions

View file

@ -4,37 +4,13 @@ mod fetch;
mod queue;
mod repo;
use tracing::{debug_span, error, warn_span, Instrument};
use super::{Repo, Server};
async fn recurring_task(state: &Server, repo: Repo) {
fetch::update(state.config, repo.clone())
.instrument(debug_span!("fetch refs"))
.await;
async {
if let Err(e) = repo::update(&state.db, repo).await {
error!("Error updating repo:\n{e:?}");
};
}
.instrument(debug_span!("update repo"))
.await;
async {
if let Err(e) = queue::update(&state.db).await {
error!("Error updating queue:\n{e:?}");
};
}
.instrument(debug_span!("update queue"))
.await;
}
pub(super) async fn run(server: Server, repo: Repo) {
loop {
recurring_task(&server, repo.clone())
.instrument(warn_span!("update"))
.await;
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;
}