Skip to content

Commit

Permalink
add auto-maint
Browse files Browse the repository at this point in the history
  • Loading branch information
mekanoe committed Sep 4, 2023
1 parent ad8105c commit 96cb2c8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/tasks/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ async fn main() {
cmd_prune().await;
println!("Done!");
}
"auto-maintenance" => loop {
println!("Running maintenance tasks...");
if !migrations::is_migrated().await {
println!("DB is not migrated, running migrations...");
cmd_migrate().await;
}

cmd_prune().await;
tokio::time::sleep(tokio::time::Duration::from_secs(60 * 5)).await;
},
"migrate" => cmd_migrate().await,
"print-env" => {
std::env::vars().for_each(|(key, value)| println!("{}={}", key, value));
Expand Down

0 comments on commit 96cb2c8

Please sign in to comment.