[feature] Adjust temporary upload settings#191
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR reduces upload parallelism and slice size to improve stability and resource usage during file uploads. The changes focus on making the initial upload experience more stable on constrained networks and devices.
- Reduced upload worker count from 6 to 2 to prevent bandwidth saturation
- Decreased maximum slice size from 4MB to 1MB for better memory usage and resume granularity
- Code cleanup including fixing variable naming, removing unused imports, and improving error handling
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| FileUploadProcessor.cs | Reduced concurrent upload workers from 6 to 2 and improved exception type specificity |
| SlicerEncrypter.cs | Set slice size to 1MB, fixed variable naming, removed unused import, and improved async handling |
| FileUploadProcessorTests.cs | Updated test to verify 2 workers instead of 6 and added null-forgiving operators |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| using (var cts = new CancellationTokenSource()) | ||
| { | ||
| await cryptoStream.WriteAsync(bytes.AsMemory(0, readBytes), cts.Token);; | ||
| } |
There was a problem hiding this comment.
The CancellationTokenSource is created but never used for actual cancellation. Either remove the using block and pass CancellationToken.None, or connect it to a proper cancellation mechanism. Also, there's a double semicolon at the end of line 108.
| using (var cts = new CancellationTokenSource()) | |
| { | |
| await cryptoStream.WriteAsync(bytes.AsMemory(0, readBytes), cts.Token);; | |
| } | |
| await cryptoStream.WriteAsync(bytes.AsMemory(0, readBytes), CancellationToken.None); |
|



Summary
Reduce initial upload parallelism and slice size to improve stability on first-run uploads and lower resource usage on constrained networks/devices.
Changes
src/ByteSync.Client/Services/Communications/Transfers/Uploading/FileUploadProcessor.cssrc/ByteSync.Client/Services/Encryptions/SlicerEncrypter.csMaxSliceLengthto 1 MB (was effectively 4 MB).System.Threading.Tasksusing.MaxSliceLengthassignment.Rationale
Impact