Search code examples
androidandroid-jetpackandroid-workmanagerworkmanagers

WorkManager is not taking retry delay less than 10 seconds


I would like to add RETRY mechanism for WorkManager (gradle dependency - implementation 'android.arch.work:work-runtime:1.0.1').

I tried applying BackOff Policy with duration less than 10 second and even than the manager is retrying calling API after 10 second only.

request.setBackoffCriteria(BackoffPolicy.LINEAR, 5, TimeUnit.SECONDS);

Below is the logcat information:

2019-05-09 11:51:15.355 25247-25416/ I/WM-WorkerWrapper: Worker result RETRY for Work [ id=2b41ed0d-3aaa-438f-8dda-ddc0e9ff0293, tags={ LoginWork, mobile.android.workers.LoginJobWorker } ]

2019-05-09 11:51:25.779 25247-25416/ I/WM-WorkerWrapper: Worker result RETRY for Work [ id=2b41ed0d-3aaa-438f-8dda-ddc0e9ff0293, tags={ LoginWork, mobile.android.workers.LoginJobWorker } ]

Solution

  • Hi I believe the minimum back of time is set at 10 seconds according to the docs the back off time needs to be set between MIN_BACKOFF_MILLIS and MAX_BACKOFF_MILLIS please see the docs here