diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-24 12:45:26 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-24 12:45:26 +0000 |
| commit | 3f4dc8e1bc07f88c064d4734f5cc3ee87b1497e4 (patch) | |
| tree | c25575ba4652e4179ff64f11605228b005de5e64 /src/main.rs | |
| parent | 62f829e2743c1fc5df108d10f1ee579f8568a91a (diff) | |
add background job to clean up grasp-audit test events and git repos
Spawns a tokio task that runs every 30 minutes and removes all events
tagged 'grasp-audit-test-event' older than 2 hours from the LMDB
database, along with their associated bare git repositories on disk.
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index bf3aefb..12a875c 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -7,6 +7,7 @@ use tracing::{error, info, warn}; | |||
| 7 | use tracing_subscriber::{EnvFilter, FmtSubscriber}; | 7 | use tracing_subscriber::{EnvFilter, FmtSubscriber}; |
| 8 | 8 | ||
| 9 | use ngit_grasp::{ | 9 | use ngit_grasp::{ |
| 10 | audit_cleanup, | ||
| 10 | config::{Config, DatabaseBackend}, | 11 | config::{Config, DatabaseBackend}, |
| 11 | git, http, | 12 | git, http, |
| 12 | metrics::Metrics, | 13 | metrics::Metrics, |
| @@ -175,6 +176,14 @@ async fn main() -> Result<()> { | |||
| 175 | }); | 176 | }); |
| 176 | info!("Expired event cleanup task started (24h interval, keeps 7 days)"); | 177 | info!("Expired event cleanup task started (24h interval, keeps 7 days)"); |
| 177 | 178 | ||
| 179 | // Spawn audit event cleanup task (30m interval, removes events >2h old) | ||
| 180 | let audit_db = relay_with_db.database.clone(); | ||
| 181 | let audit_git_path = PathBuf::from(config.effective_git_data_path()); | ||
| 182 | tokio::spawn(async move { | ||
| 183 | audit_cleanup::run_audit_cleanup_loop(audit_db, audit_git_path).await; | ||
| 184 | }); | ||
| 185 | info!("Audit event cleanup task started (30m interval, removes events >2h old)"); | ||
| 186 | |||
| 178 | // Start purgatory sync loop for background git data fetching | 187 | // Start purgatory sync loop for background git data fetching |
| 179 | // Create naughty list tracker for git remote domains with persistent errors (12h expiration) | 188 | // Create naughty list tracker for git remote domains with persistent errors (12h expiration) |
| 180 | let git_naughty_list = Arc::new(NaughtyListTracker::with_defaults()); | 189 | let git_naughty_list = Arc::new(NaughtyListTracker::with_defaults()); |