diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2020-05-20 14:57:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-20 14:57:54 +0200 |
commit | 44f35cb1f19443634cc921a1addc6f500a9a3850 (patch) | |
tree | ed9dd588fa172e072cf4fd600d56b811be07e462 /core | |
parent | dd02b4b5cf2b8bd9eb7661fa530787e1dcff9b14 (diff) | |
parent | fda270575ffc3998e148133a6208a49276fc4b7f (diff) | |
download | AntennaPod-44f35cb1f19443634cc921a1addc6f500a9a3850.zip |
Merge pull request #4173 from ByteHamster/retry-gpodder
Retry gpodder sync before notifying
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java b/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java index f0b34891b..6985e4421 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java @@ -97,7 +97,10 @@ public class SyncService extends Worker { EventBus.getDefault().postSticky(new SyncServiceEvent(R.string.sync_status_error)); prefs.putBoolean(PREF_LAST_SYNC_ATTEMPT_SUCCESS, false).apply(); Log.e(TAG, Log.getStackTraceString(e)); - updateErrorNotification(e); + if (getRunAttemptCount() % 3 == 2) { + // Do not spam users with notification and retry before notifying + updateErrorNotification(e); + } return Result.retry(); } } @@ -192,7 +195,6 @@ public class SyncService extends Worker { OneTimeWorkRequest workRequest = getWorkRequest() .setInitialDelay(0L, TimeUnit.SECONDS) - .setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 1, TimeUnit.MINUTES) .build(); WorkManager.getInstance(context).enqueueUniqueWork(WORK_ID_SYNC, ExistingWorkPolicy.REPLACE, workRequest); EventBus.getDefault().postSticky(new SyncServiceEvent(R.string.sync_status_started)); @@ -209,6 +211,7 @@ public class SyncService extends Worker { return new OneTimeWorkRequest.Builder(SyncService.class) .setConstraints(constraints.build()) + .setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 10, TimeUnit.MINUTES) .setInitialDelay(5L, TimeUnit.SECONDS); // Give it some time, so other actions can be queued } |