diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-27 21:55:34 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-27 21:55:34 +0000 |
| commit | efc3da477d4edb9d1334718e3e20d197ba711468 (patch) | |
| tree | a00daf545c8bd5dc723676cbe07d2b20d5a9080f | |
| parent | 6d920cae2704016869500889a92b358d845b69e1 (diff) | |
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.
| -rw-r--r-- | src/purgatory/sync/functions.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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<C: SyncContext + ?Sized>( | |||
| 368 | let fetch_result = ctx.fetch_oids(&target_repo, url, &needed_oids).await; | 368 | let fetch_result = ctx.fetch_oids(&target_repo, url, &needed_oids).await; |
| 369 | throttle_manager.complete_request(&domain); | 369 | throttle_manager.complete_request(&domain); |
| 370 | 370 | ||
| 371 | let oids_fetched = match fetch_result { | 371 | let fetched_oids = match fetch_result { |
| 372 | Ok(fetched) if !fetched.is_empty() => { | 372 | Ok(fetched) if !fetched.is_empty() => { |
| 373 | debug!( | 373 | debug!( |
| 374 | identifier = %identifier, | 374 | identifier = %identifier, |
| @@ -376,7 +376,7 @@ pub async fn sync_identifier_from_url<C: SyncContext + ?Sized>( | |||
| 376 | oids_fetched = fetched.len(), | 376 | oids_fetched = fetched.len(), |
| 377 | "Fetch succeeded" | 377 | "Fetch succeeded" |
| 378 | ); | 378 | ); |
| 379 | fetched.len() | 379 | fetched |
| 380 | } | 380 | } |
| 381 | Ok(_) => { | 381 | Ok(_) => { |
| 382 | debug!( | 382 | debug!( |
| @@ -384,7 +384,7 @@ pub async fn sync_identifier_from_url<C: SyncContext + ?Sized>( | |||
| 384 | url = %url, | 384 | url = %url, |
| 385 | "Fetch returned no OIDs (not available on remote)" | 385 | "Fetch returned no OIDs (not available on remote)" |
| 386 | ); | 386 | ); |
| 387 | 0 | 387 | vec![] |
| 388 | } | 388 | } |
| 389 | Err(e) => { | 389 | Err(e) => { |
| 390 | debug!( | 390 | debug!( |
| @@ -393,13 +393,13 @@ pub async fn sync_identifier_from_url<C: SyncContext + ?Sized>( | |||
| 393 | error = %e, | 393 | error = %e, |
| 394 | "Fetch failed" | 394 | "Fetch failed" |
| 395 | ); | 395 | ); |
| 396 | 0 | 396 | vec![] |
| 397 | } | 397 | } |
| 398 | }; | 398 | }; |
| 399 | 399 | ||
| 400 | // Try to process any events that can now be satisfied | 400 | // Try to process any events that can now be satisfied |
| 401 | if oids_fetched > 0 { | 401 | if !fetched_oids.is_empty() { |
| 402 | let new_oids: HashSet<String> = needed_oids.into_iter().collect(); | 402 | let new_oids: HashSet<String> = fetched_oids.iter().cloned().collect(); |
| 403 | if let Err(e) = ctx | 403 | if let Err(e) = ctx |
| 404 | .process_newly_available_git_data(&target_repo, &new_oids) | 404 | .process_newly_available_git_data(&target_repo, &new_oids) |
| 405 | .await | 405 | .await |
| @@ -412,7 +412,7 @@ pub async fn sync_identifier_from_url<C: SyncContext + ?Sized>( | |||
| 412 | } | 412 | } |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | oids_fetched | 415 | fetched_oids.len() |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | /// Sync git data for an identifier. | 418 | /// Sync git data for an identifier. |