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

Handling onRun() in Job

Open abdymm opened this issue 7 years ago • 1 comments

halo @yigit, it's possible for handling Job `onRun'?

let's say I have two Job, it's called FirstJob and SecondJob. FirstJob have the Highest priority, I want to execute SecondJob when FirstJob it's really done.

on onAdded method it's good the called sequential or FirstJob first and then SecondJob. on onRun method, it will indeed be called sequential, FirstJob first and then SecondJob even the FirstJob still not get the response from network service, the SecondJob its still running and it can cause the SecondJob will be executed first in API service and got on error.

My question, is it possible to handle jobs in OnRun method, like the example above SecondJob onRun method will be called when FirstJob OnRun is really done, i mean get a response from the network ?

abdymm avatar Jul 13 '17 00:07 abdymm

If you set a group id for the two jobs they would run sequentially. The second job would only run if the first was removed via successful run, cancellation or reaching the retry limit.

The alternative is to just perform your API service calls in one job unless you needed to run them independently at some point.

dsardari avatar Jul 21 '17 05:07 dsardari