From 1b6b669b9b82d1f81b887a32055f19c53d3bb8bf Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Sat, 10 Jan 2026 02:14:01 +0000 Subject: Add naughty list for git remotes with persistent SSL/DNS errors Implement domain-level naughty list tracking for git remotes, reusing the existing NaughtyListTracker from relay sync. This prevents repeated attempts to fetch from git domains with persistent infrastructure issues (SSL/TLS certificate errors, DNS failures). Changes: - Updated NaughtyListTracker to track both relay URLs and git domains - Added git_naughty_list field to RealSyncContext for error classification - Modified fetch_oids() to classify git fetch errors and record naughty domains - Updated sync_identifier_next_url() to filter out naughty domains during URL selection - Added git_naughty_list parameter to ThrottleManager for domain queue processing - Threaded naughty list through start_sync_loop and all sync functions - Updated all tests to pass naughty list parameter The naughty list uses 12-hour expiration (configurable) to allow domains to recover from infrastructure issues. First occurrence logs WARN, repeats log DEBUG. --- src/purgatory/sync/loop.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/purgatory/sync/loop.rs') diff --git a/src/purgatory/sync/loop.rs b/src/purgatory/sync/loop.rs index 92e0594..1ab229d 100644 --- a/src/purgatory/sync/loop.rs +++ b/src/purgatory/sync/loop.rs @@ -15,6 +15,7 @@ use tokio::task::JoinHandle; use tracing::{debug, info}; use crate::purgatory::Purgatory; +use crate::sync::naughty_list::NaughtyListTracker; use super::context::SyncContext; use super::functions::sync_identifier; @@ -37,6 +38,7 @@ impl Purgatory { /// # Arguments /// * `ctx` - The sync context providing repository data and fetch capabilities /// * `throttle_manager` - Used for rate limiting and domain queue management + /// * `git_naughty_list` - Tracker for git remote domains with persistent errors /// /// # Returns /// A `JoinHandle` for the background task (can be used to cancel the loop) @@ -47,12 +49,13 @@ impl Purgatory { /// let purgatory = Arc::new(Purgatory::new("/data/git")); /// let ctx = Arc::new(RealSyncContext::new(...)); /// let throttle_manager = Arc::new(ThrottleManager::new(5, 30)); + /// let git_naughty_list = Arc::new(NaughtyListTracker::with_defaults()); /// /// // Set context on throttle manager for queue processing /// throttle_manager.set_context(ctx.clone()); /// /// // Start the sync loop - /// let handle = purgatory.start_sync_loop(ctx, throttle_manager); + /// let handle = purgatory.start_sync_loop(ctx, throttle_manager, git_naughty_list); /// /// // Later, to stop the loop: /// handle.abort(); @@ -61,6 +64,7 @@ impl Purgatory { self: Arc, ctx: Arc, throttle_manager: Arc, + git_naughty_list: Arc, ) -> JoinHandle<()> { info!( "Starting purgatory sync loop (interval: {:?})", @@ -121,6 +125,7 @@ impl Purgatory { let purgatory = self.clone(); let ctx = ctx.clone(); let throttle_manager = throttle_manager.clone(); + let git_naughty_list = git_naughty_list.clone(); let id = identifier.clone(); tokio::spawn(async move { @@ -129,7 +134,13 @@ impl Purgatory { "Starting sync task for identifier" ); - let complete = sync_identifier(ctx.as_ref(), &id, &throttle_manager).await; + let complete = sync_identifier( + ctx.as_ref(), + &id, + &throttle_manager, + git_naughty_list.as_ref(), + ) + .await; // Check final state and update queue if complete || !purgatory.has_pending_events(&id) { -- cgit v1.2.3