Feature Request P4
Status Update
Comments
em...@google.com <em...@google.com>
ra...@google.com <ra...@google.com>
va...@gmail.com <va...@gmail.com> #2
Not at the moment. But we have been asked this before, so I will treat this as a feature request.
Description
For each upload, the following code will execute:
workManager.beginUniqueWork(UPLOAD_WORK_CONTINUATION, ExistingWorkPolicy.APPEND_OR_REPLACE, compressWorkRequest)
.then(uploadWorkRequest)
.enqueue()
Now imagine the user cancels the first upload. If I cancel the Worker while the first file is being compressed, all following enqueued Work will never run. Right now there's no other choice but to let the Worker finish, call Result.success() and signal any cancellation by other means (I went for EventBus).
But even worse, what if in the queue of 10 files, the user wants to cancel upload n°5? Since I can't cancel the Worker, I have to save the signal and wait until the Worker runs...
I think the base logic of a UniqueWorkChain is great, but there has to be a way to cancel Workers without affecting other Work adding with workManager.beginUniqueWork()