Skip to content

Commit ada3a13

Browse files
authored
Merge pull request #6900 from seadowg/error-notification
Don't retry tasks when running in foreground
2 parents 9fa7ee8 + 9a6647e commit ada3a13

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

async/src/main/java/org/odk/collect/async/TaskSpecWorker.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ class TaskSpecWorker(
6161

6262
try {
6363
val completed =
64-
taskSpec.getTask(applicationContext, stringInputData, isLastUniqueExecution(taskSpec)) { isStopped }.get()
64+
taskSpec.getTask(applicationContext, stringInputData, foreground || isLastUniqueExecution(taskSpec)) { isStopped }.get()
6565
val maxRetries = taskSpec.maxRetries
6666

6767
return if (completed) {
6868
Result.success()
69-
} else if (maxRetries == null || runAttemptCount < maxRetries) {
69+
} else if (!foreground && (maxRetries == null || runAttemptCount < maxRetries)) {
7070
Result.retry()
7171
} else {
7272
Result.failure()

collect_app/src/main/java/org/odk/collect/android/formlists/blankformlist/BlankFormListViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class BlankFormListViewModel(
211211
private const val SYNC_NOTIFICATION_CHANNEL = "form_updates"
212212
private const val SYNC_NOTIFICATION_CHANNEL_NAME = "Form updates"
213213

214-
private const val SYNC_NOTIFICATION_ID = 1
214+
private const val SYNC_NOTIFICATION_ID = 3
215215

216216
private fun getSyncTag(projectId: String): String {
217217
return "match_exactly_foreground:$projectId"

0 commit comments

Comments
 (0)