From 3f4dc8e1bc07f88c064d4734f5cc3ee87b1497e4 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 24 Feb 2026 12:45:26 +0000 Subject: 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. --- src/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main.rs') 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}; use tracing_subscriber::{EnvFilter, FmtSubscriber}; use ngit_grasp::{ + audit_cleanup, config::{Config, DatabaseBackend}, git, http, metrics::Metrics, @@ -175,6 +176,14 @@ async fn main() -> Result<()> { }); info!("Expired event cleanup task started (24h interval, keeps 7 days)"); + // Spawn audit event cleanup task (30m interval, removes events >2h old) + let audit_db = relay_with_db.database.clone(); + let audit_git_path = PathBuf::from(config.effective_git_data_path()); + tokio::spawn(async move { + audit_cleanup::run_audit_cleanup_loop(audit_db, audit_git_path).await; + }); + info!("Audit event cleanup task started (30m interval, removes events >2h old)"); + // Start purgatory sync loop for background git data fetching // Create naughty list tracker for git remote domains with persistent errors (12h expiration) let git_naughty_list = Arc::new(NaughtyListTracker::with_defaults()); -- cgit v1.2.3