android-priority-jobqueue icon indicating copy to clipboard operation
android-priority-jobqueue copied to clipboard

Feature request: replace a queued single instance job

Open ckirkman opened this issue 8 years ago • 6 comments

Currently (as I understand it) when a Job is queued with a single id and a second Job with the same single id is created, the second job will have Job.onCancel() called.

It would be useful to be able to configure a Param to change this behavior to cancel the previously queued Job and add the most recently added Job instead.

ckirkman avatar Oct 13 '16 21:10 ckirkman

@yigit what the status of this enhancement? Could we achieve this with current state of the library?

IlyaEremin avatar Nov 16 '16 17:11 IlyaEremin

Hello, how can you keep only the last Job and cancel any previous Jobs with the same single instance id, is there a way to achieve this at the moment?

ionfist avatar Jan 25 '17 15:01 ionfist

@ionfist, unless this enhancement is implemented you can separately maintain a list of Job IDs for the job(s) you want to cancel if you have an updated replacement. You can then call JobManager.getJobStatus(jobId) to see if the previously queued job is running / waiting. If it is then you can cancel it with JobManager.cancelJobs(). Then add your new Job.

ckirkman avatar Jan 25 '17 18:01 ckirkman

+1

aftabsikander avatar Feb 15 '17 19:02 aftabsikander

I'm having the same problem... When the user edits its profile and its offline, I want to keep just the latest change profile request and cancel the previous ones. I'm quite blocked by this right now...how can I achieve this? I see there's no activity on this library in the last half a year...Did it died already?

vasimihalca avatar Aug 31 '17 08:08 vasimihalca

i don't think it died, is just that architecture components drain all my time :'(. you can always keep the data in somewhere (db?) and create a single instance job each time user updates the profile. Then just add a new job each time profile is changed.

yigit avatar Sep 02 '17 19:09 yigit