Skip to content

fix(sync): count all files in failed upload batch as failed#3187

Merged
tusharmath merged 6 commits intomainfrom
fix/show-the-correct-count-for-failed-files
Apr 28, 2026
Merged

fix(sync): count all files in failed upload batch as failed#3187
tusharmath merged 6 commits intomainfrom
fix/show-the-correct-count-for-failed-files

Conversation

@laststylebender14
Copy link
Copy Markdown
Contributor

@laststylebender14 laststylebender14 commented Apr 28, 2026

Summary

Fix failed_files undercounting when a batch upload fails — a batch of N files was counted as 1 failure instead of N.

Context

The upload stream processes files in batches of up to batch_size. When a batch upload failed, the error handler incremented failed_files += 1 regardless of how many files were in the batch. With a batch size of 100, a single failed batch would only report 1 failed file instead of 100, causing the final SyncProgress::Completed event and the sync error to report incorrect counts.

Changes

  • Changed the upload_files stream item type from Result<usize, Error> to (usize, Result<(), Error>), so the batch's attempted file count is always available regardless of success or failure
  • Capture attempted = batch.len() before the async block so it's accessible in both the success and failure branches
  • On success: counter.complete(attempted) (same as before, now using the tuple)
  • On failure: failed_files += attempted instead of += 1

Testing

cargo check -p forge_services

@github-actions github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Apr 28, 2026
@laststylebender14 laststylebender14 marked this pull request as ready for review April 28, 2026 05:41
@tusharmath tusharmath merged commit f460611 into main Apr 28, 2026
8 checks passed
@tusharmath tusharmath deleted the fix/show-the-correct-count-for-failed-files branch April 28, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants