Hi i am using WorkManager
with UniqueWork
. I have this use case: my UniqueWork
was delayed by server error 500
and the work is scheduled by backoff policy and I would like know if is possible to force UniqueWork
to fire immediately? Thanks for answers.
The backoff policy is used by WorkManager only when you return Result.retry()
from your worker. The minimum value you can set is 10 seconds (MIN_BACKOFF_MILLIS
).
How you handle a server returning HTTP code 500
is completely up to your worker. You can also loop internally the worker for as many time you want retrying the request if this is what you want. The only limit is the 10 minutes max that a worker can last (or you can promote it to a Foreground Service using setForeground()
(starting from v2.3-alpha02).
What you can do is retry internally in the Worker a given amount of times (e.g. 3) and if this doesn't work, handle it as a service not available and retry in the future.