Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Version used: 2.7.0
Devices/Android versions reproduced on: Samsung Galaxy A50 / Android 11
When using a PeriodicWorkRequest in combination with a flexInterval, there is a different behavior in manual execution and unitTesting.
If the app is executed manually, there is no initial call of the WorkerClass.
If the PeriodicWorkRequest is executed in an UnitTest, the WorkerClass is initially triggered.
PeriodicWorkRequest.Builder(
Worker:: class.java,
60,
TimeUnit.MINUTES,
15,
TimeUnit.MINUTES
)
.setBackoffCriteria(BackoffPolicy.LINEAR, 15, TimeUnit.MINUTES)
.setInputData(inputData)
.build()
So manually the WorkerClass does his job in between 45 – 60 min.
With unitTesting the WorkerClass runs ones at 0 and then in between 45 – 60 min.
Tested with setPeriodDelayMet using a TestDriver.
The same thing happens when using a setInitialDelay and then testing with setInitialDelayMet.
Can someone confirm or reject this behaviour?