From 847acdecb9c28a5307123b9ee685b769a598cfc1 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 27 Jan 2026 21:40:46 +0000 Subject: fix: distinguish 0 OIDs fetched from successful fetch in logging When fetch_oids returns Ok(vec![]) (all requested OIDs missing from remote), the log message now says 'Fetch returned no OIDs (not available on remote)' instead of the misleading 'Fetch succeeded' with oids_fetched=0. --- src/purgatory/sync/functions.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/purgatory/sync/functions.rs') diff --git a/src/purgatory/sync/functions.rs b/src/purgatory/sync/functions.rs index 65d29af..2b7e71f 100644 --- a/src/purgatory/sync/functions.rs +++ b/src/purgatory/sync/functions.rs @@ -369,7 +369,7 @@ pub async fn sync_identifier_from_url( throttle_manager.complete_request(&domain); let oids_fetched = match fetch_result { - Ok(fetched) => { + Ok(fetched) if !fetched.is_empty() => { debug!( identifier = %identifier, url = %url, @@ -378,6 +378,14 @@ pub async fn sync_identifier_from_url( ); fetched.len() } + Ok(_) => { + debug!( + identifier = %identifier, + url = %url, + "Fetch returned no OIDs (not available on remote)" + ); + 0 + } Err(e) => { debug!( identifier = %identifier, -- cgit v1.2.3 From efc3da477d4edb9d1334718e3e20d197ba711468 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 27 Jan 2026 21:55:34 +0000 Subject: fix: pass actually fetched OIDs to process_newly_available_git_data Previously, sync_identifier_from_url passed all needed OIDs to process_newly_available_git_data, not just the OIDs that were successfully fetched. This caused incorrect logging (new_oids_count would show all needed OIDs, not just fetched ones). While this didn't break functionality (the actual processing uses can_apply_state which checks the repository on disk), it made debugging confusing. Changes: - Rename oids_fetched to fetched_oids and change type from usize to Vec - Return Vec from match arms instead of counts - Pass fetched_oids (not needed_oids) to process_newly_available_git_data - Return fetched_oids.len() at the end This ensures logging accurately reflects which OIDs were actually fetched from the remote. --- src/purgatory/sync/functions.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/purgatory/sync/functions.rs') diff --git a/src/purgatory/sync/functions.rs b/src/purgatory/sync/functions.rs index 2b7e71f..9207d58 100644 --- a/src/purgatory/sync/functions.rs +++ b/src/purgatory/sync/functions.rs @@ -368,7 +368,7 @@ pub async fn sync_identifier_from_url( let fetch_result = ctx.fetch_oids(&target_repo, url, &needed_oids).await; throttle_manager.complete_request(&domain); - let oids_fetched = match fetch_result { + let fetched_oids = match fetch_result { Ok(fetched) if !fetched.is_empty() => { debug!( identifier = %identifier, @@ -376,7 +376,7 @@ pub async fn sync_identifier_from_url( oids_fetched = fetched.len(), "Fetch succeeded" ); - fetched.len() + fetched } Ok(_) => { debug!( @@ -384,7 +384,7 @@ pub async fn sync_identifier_from_url( url = %url, "Fetch returned no OIDs (not available on remote)" ); - 0 + vec![] } Err(e) => { debug!( @@ -393,13 +393,13 @@ pub async fn sync_identifier_from_url( error = %e, "Fetch failed" ); - 0 + vec![] } }; // Try to process any events that can now be satisfied - if oids_fetched > 0 { - let new_oids: HashSet = needed_oids.into_iter().collect(); + if !fetched_oids.is_empty() { + let new_oids: HashSet = fetched_oids.iter().cloned().collect(); if let Err(e) = ctx .process_newly_available_git_data(&target_repo, &new_oids) .await @@ -412,7 +412,7 @@ pub async fn sync_identifier_from_url( } } - oids_fetched + fetched_oids.len() } /// Sync git data for an identifier. -- cgit v1.2.3