Update repo repeatedly

This commit is contained in:
Joscha 2023-08-04 20:05:38 +02:00
parent 0a555dd9b4
commit 980e84b0f6
5 changed files with 72 additions and 24 deletions

19
src/update.rs Normal file
View file

@ -0,0 +1,19 @@
//! Repeatedly update the db from the repo.
use tracing::{warn, debug};
use crate::state::AppState;
async fn update_repo(state: &AppState) -> anyhow::Result<()> {
debug!("Updating repo");
Ok(())
}
pub async fn repeatedly(state: AppState) {
loop {
if let Err(e) = update_repo(&state).await {
warn!("Error while updating repo: {e:?}");
}
tokio::time::sleep(state.config.repo_update_delay).await;
}
}