Repository navigation
fix(auto-upload): start auto upload right after resuming global upload pause - #17806
Open
ToteMeiSter wants to merge 1 commit into
Open
ToteMeiSter wants to merge 1 commit into
ToteMeiSter wants to merge 1 commit into
Conversation
…d pause Resuming the global upload pause on the uploads screen only restarted FileUploadWorker. AutoUploadWorker stops without uploading while the pause is active, so its folders stayed idle until the next periodic AutoUploadRescanWorker run. Start the auto upload of all enabled synced folders when the pause is lifted. FilesSyncHelper.startAutoUploadForEnabledSyncedFolders is used instead of startAutoUploadForEnabledSyncedFoldersIfNotActive: the latter calls isAutoUploadScheduled, which blocks on WorkManager's ListenableFuture, and this code runs on the main thread from a menu click. The chosen method enqueues with ExistingWorkPolicy.KEEP when power saving is not overridden, so a worker that is already running or enqueued is left alone and no upload is cancelled mid transfer. A worker that stopped because of the pause has finished, so a new one is enqueued. Add an injectable FileUploadHelper provider to UploadListMenuProvider so the menu logic can be unit tested without the application component. Signed-off-by: Krainov Gleb <krajnov.g@kontentplus.ru> Assisted-by: Claude-Code:claude-opus-5-5
This was referenced Oct 12, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This branch has not been deployed
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.
Problem
Refs #17576
Since #17632 the global pause on the uploads screen also stops auto upload:
AutoUploadWorkerchecks the pause before it starts and before each file. When the pause is lifted,UploadListMenuProvider.toggleGlobalPauserestarts onlyFileUploadWorker.AutoUploadWorkeris not started again, so the synced folders stay idle until the next trigger, usually the periodicAutoUploadRescanWorker. No file is lost, but the upload can wait for the whole period.Change
When the pause is lifted,
toggleGlobalPausecallsFilesSyncHelper.startAutoUploadForEnabledSyncedFolders(syncedFolderProvider, backgroundJobManager, overridePowerSaving = false).UploadListFragmentpassesSyncedFolderProviderandBackgroundJobManagerto the menu provider.Notes
startAutoUploadForEnabledSyncedFoldersIfNotActiveis not used: it callsisAutoUploadScheduled, which blocks on WorkManager'sListenableFuture.get(), and this code runs on the main thread from a menu click.overridePowerSaving = falsethe work is enqueued withExistingWorkPolicy.KEEP. A worker that is running or enqueued is left alone, no upload is cancelled. A worker that stopped because of the pause has finished, so a new one is enqueued.UploadListMenuProvidergets a() -> FileUploadHelperprovider (defaultFileUploadHelper.instance()), becauseFileUploadHelper.instance()needsMainApp.getAppComponent()and cannot be called in a unit test.UploadListFragment,UploadListMenuProviderand its test. No file overlap with the other three PRs (fix(auto-upload): restart folder runs that stay enqueued on rescan #17805, fix(sharing): download file before "Send copy to" #17807, fix(share): send original file instead of cached thumbnail #17808); trial merge of all four is clean.How to test
UploadListMenuProviderTest(resuming global pause starts auto upload of enabled folders without waiting for the rescan) fails without the change (WantedButNotInvoked), passes with it.🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)
The change was drafted with Claude Code (
Assisted-by: Claude-Code:claude-opus-5-5).