Repository navigation
fix(auto-upload): start auto upload right after resuming global upload pause - #17806
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
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
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).