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<String>
- Return Vec<String> 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.
This commit is contained in:
DanConwayDev
2026-01-27 21:55:34 +00:00
parent 6d920cae27
commit efc3da477d
+7 -7
View File
@@ -368,7 +368,7 @@ pub async fn sync_identifier_from_url<C: SyncContext + ?Sized>(
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<C: SyncContext + ?Sized>(
oids_fetched = fetched.len(),
"Fetch succeeded"
);
fetched.len()
fetched
}
Ok(_) => {
debug!(
@@ -384,7 +384,7 @@ pub async fn sync_identifier_from_url<C: SyncContext + ?Sized>(
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<C: SyncContext + ?Sized>(
error = %e,
"Fetch failed"
);
0
vec![]
}
};
// Try to process any events that can now be satisfied
if oids_fetched > 0 {
let new_oids: HashSet<String> = needed_oids.into_iter().collect();
if !fetched_oids.is_empty() {
let new_oids: HashSet<String> = 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<C: SyncContext + ?Sized>(
}
}
oids_fetched
fetched_oids.len()
}
/// Sync git data for an identifier.