Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix: change worker policy from KEEP to REPLACE to ensure the workers …
Browse files Browse the repository at this point in the history
…will be executed after a force stop
  • Loading branch information
marcouberti committed Sep 15, 2020
1 parent 1300632 commit b8f461c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class WorkerManager(

private val settings get() = settingsManager.settings.value

fun scheduleOnboardingNotCompletedWorker(policy: ExistingWorkPolicy = ExistingWorkPolicy.KEEP) {
fun scheduleOnboardingNotCompletedWorker(policy: ExistingWorkPolicy = ExistingWorkPolicy.REPLACE) {
workManager.enqueueUniqueWork(
"OnboardingNotCompletedWorker",
policy,
Expand All @@ -73,7 +73,7 @@ class WorkerManager(
val delay = settings.requiredUpdateNotificationPeriod.toLong()
workManager.enqueueUniqueWork(
"ForceUpdateNotificationWorker",
ExistingWorkPolicy.KEEP,
ExistingWorkPolicy.REPLACE,
OneTimeWorkRequest.Builder(ForceUpdateNotificationWorker::class.java)
.setInitialDelay(
if (withDelay) delay else 0,
Expand Down Expand Up @@ -117,7 +117,7 @@ class WorkerManager(

fun updateRiskReminderWorker(exposureStatus: ExposureStatus) {
if (exposureStatus is ExposureStatus.Exposed && !exposureStatus.acknowledged) {
scheduleRiskReminderWorker(ExistingWorkPolicy.KEEP)
scheduleRiskReminderWorker(ExistingWorkPolicy.REPLACE)
} else {
cancelRiskReminderWorker()
}
Expand Down

0 comments on commit b8f461c

Please sign in to comment.