Skip to content

[fix] Improve upload retry resilience#292

Merged
paul-fresquet merged 5 commits intomasterfrom
fix/upload-retry-resilience
Apr 27, 2026
Merged

[fix] Improve upload retry resilience#292
paul-fresquet merged 5 commits intomasterfrom
fix/upload-retry-resilience

Conversation

@paul-fresquet
Copy link
Copy Markdown
Contributor

Summary

  • Increase retry timeout budgets for stale upload slices created before adaptive downscale catches up.
  • Reduce queued slice backlog so new slices reflect the latest adaptive chunk size sooner.
  • Cancel sibling upload workers after a fatal upload failure to avoid uploads continuing after terminal errors.

Test plan

  • dotnet build ByteSync.sln --artifacts-path ".artifacts/pr3-build-output"
  • dotnet test tests/ByteSync.Client.UnitTests/ByteSync.Client.UnitTests.csproj --artifacts-path ".artifacts/pr3-test-output"
  • dotnet test tests/ByteSync.Client.IntegrationTests/ByteSync.Client.IntegrationTests.csproj --filter Upload_SliceAndParallelism_Tests --artifacts-path ".artifacts/pr3-integration-output"

Made with Cursor

Give stale pre-downscale slices a larger retry timeout budget and stop sibling upload workers promptly after fatal upload failures.

Made-with: Cursor
@paul-fresquet paul-fresquet requested a review from Copilot April 26, 2026 01:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Improve upload retry resilience by increasing timeout budgets for stale slices, tightening slice queue backpressure, and canceling sibling upload workers after fatal failures.

Changes:

  • Introduce UploadAttemptTimeoutPolicy and unit tests to compute per-attempt upload timeouts with stale-slice penalties and ceilings.
  • Reduce FileUploadCoordinator channel capacity to apply tighter backpressure so new slices reflect adaptive chunk sizing sooner.
  • Cancel sibling workers on fatal failures by canceling the shared CancellationTokenSource and adding early-exit handling in workers.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/ByteSync.Client.UnitTests/Services/Communications/Transfers/Uploading/UploadAttemptTimeoutPolicyTests.cs Adds unit tests covering new timeout policy behavior (floor, retry growth, stale-slice penalty, ceiling).
tests/ByteSync.Client.UnitTests/Services/Communications/Transfers/Uploading/FileUploadWorkerTests.cs Adds tests for retrying client timeouts and canceling sibling workers on failure; updates adaptive controller defaults.
tests/ByteSync.Client.UnitTests/Services/Communications/Transfers/Uploading/FileUploadCoordinatorTests.cs Adds a test asserting bounded channel backpressure with reduced capacity.
src/ByteSync.Client/Services/Communications/Transfers/Uploading/UploadAttemptTimeoutPolicy.cs New policy encapsulating timeout computation with stale-slice retry budgeting.
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileUploadWorker.cs Switches timeout computation to new policy, adds cancellation logic to stop sibling workers after fatal errors, enhances logging.
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileUploadCoordinator.cs Reduces channel capacity from 8 to 2 to tighten backlog/backpressure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Resolve PR feedback by bounding timeout calculations, disposing queued slices after fatal upload failures, and fixing targeted Sonar issues.

Made-with: Cursor
Cover FileSlicer cancellation cleanup paths and address the async disposal warning reported by SonarCloud.

Made-with: Cursor
Let adaptive upload timeouts control storage uploads and classify client-side transport resets so slow, unstable connections downscale instead of surfacing as server failures.

Made-with: Cursor
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link
Copy Markdown

@paul-fresquet paul-fresquet merged commit 8f1afaa into master Apr 27, 2026
25 checks passed
@paul-fresquet paul-fresquet deleted the fix/upload-retry-resilience branch April 27, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants