Skip to content

Optimize upload concurrency and fix S3 timeouts - #45

Merged
patricioxavier8 merged 1 commit into
mainfrom
fix/upload-concurrency-and-timeouts
Aug 21, 2026
Merged

patricioxavier8 merged 1 commit into
mainfrom
fix/upload-concurrency-and-timeouts

Conversation

@patricioxavier8

Copy link
Copy Markdown
Contributor

Summary

This PR optimizes the network layer's performance and resolves the S3 timeout errors reported during file uploads.

Key Changes

  • Thread Optimization: Moved the URLSession delegate callbacks from .main to a dedicated background OperationQueue. This prevents the Main Thread (qos_class_main) from being heavily burdened with progress updates during large file uploads.
  • Timeout Adjustment: Increased timeoutIntervalForRequest to 120 seconds (for both standard and multipart uploads) to improve tolerance on unstable networks.
  • Immediate Cancellation: Added native withTaskCancellationHandler support to instantly abort network tasks when a sync is cancelled.

- Increased URLSession timeoutIntervalForRequest to 120s for standard and multipart uploads to prevent premature drops (UPL-002).
- Migrated URLSession delegate callbacks from `.main` to a dedicated background `OperationQueue`, preventing UI and XPC Main Thread blocking during heavy uploads.
- Added native `withTaskCancellationHandler` support to immediately drop network requests if Swift cooperative cancellation is triggered.
@patricioxavier8
patricioxavier8 merged commit 8afad60 into main Aug 21, 2026
1 check passed
@patricioxavier8
patricioxavier8 deleted the fix/upload-concurrency-and-timeouts branch August 21, 2026 13:59
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