Tweak WorkManager task cancellation, add flex times

This commit is contained in:
arkon
2020-03-02 19:04:57 -05:00
parent d873d653d0
commit a3dd5c1e92
6 changed files with 18 additions and 24 deletions

View File

@@ -105,13 +105,8 @@ class SettingsBackupController : SettingsController() {
summary = "%s"
onChange { newValue ->
// Always cancel the previous task, it seems that sometimes they are not updated
BackupCreatorJob.cancelTask()
val interval = (newValue as String).toInt()
if (interval > 0) {
BackupCreatorJob.setupTask(interval)
}
BackupCreatorJob.setupTask(interval)
true
}
}

View File

@@ -86,13 +86,8 @@ class SettingsLibraryController : SettingsController() {
summary = "%s"
onChange { newValue ->
// Always cancel the previous task, it seems that sometimes they are not updated.
LibraryUpdateJob.cancelTask()
val interval = (newValue as String).toInt()
if (interval > 0) {
LibraryUpdateJob.setupTask(interval)
}
LibraryUpdateJob.setupTask(interval)
true
}
}