fix(upload): complete cancelAll when some uploads already finished#2235
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(upload): complete cancelAll when some uploads already finished#2235cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
cancelAll used `return` inside the task loop, so the first completed upload skipped cancelling remaining tasks and never called Workmanager.cancelAll(). Use `continue` instead so only completed entries are skipped. Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes
UploadFilesResponse.cancelAll()so it cancels every non-completed background upload and still callsWorkmanager().cancelAll(). Previously the loop usedreturnwhen it saw a completed task, which aborted the whole operation on the first completed entry.Related Issue
None filed.
Type of Change
What Has Changed
UploadFilesResponse.methods()['cancelAll'], replace mistakenreturnwithcontinuewhen skipping tasks that are alreadyUploadStatus.completed.How to Test
modules/ensemble, runflutter test(Flutter SDK on PATH perAGENTS.md).cancelAll()from script, and confirm remaining uploads are marked cancelled and workmanager cleanup runs.Screenshots / Videos
N/A
Checklist
flutter analyzeand addressed any new warningsflutter testand all tests passNote: The CI image used for this automation did not have the Flutter SDK installed, so
flutter analyze/flutter testwere not executed here. Please run them locally perAGENTS.md.Duplicate check
cancelAll/ upload batch cancellation: no existing fix for this root cause.ensemble.storage.clear()async ordering vs. binding updates); this PR does not overlap that code path.