Move backoff calculation into jobs.

This commit is contained in:
Greyson Parrelli
2021-01-28 09:48:09 -05:00
parent 6a45858b4a
commit 1d83729e6c
14 changed files with 115 additions and 112 deletions

View File

@@ -6,6 +6,8 @@ import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.jobmanager.Data;
import org.thoughtcrime.securesms.jobmanager.Job;
import org.thoughtcrime.securesms.jobmanager.JobLogger;
import org.thoughtcrime.securesms.jobmanager.impl.BackoffUtil;
import org.thoughtcrime.securesms.util.FeatureFlags;
/**
* A base class for jobs that are intended to be used in {@link ApplicationMigrations}. Some
@@ -45,7 +47,7 @@ abstract class MigrationJob extends Job {
} catch (Exception e) {
if (shouldRetry(e)) {
Log.w(TAG, JobLogger.format(this, "Encountered a retryable exception."), e);
return Result.retry();
return Result.retry(BackoffUtil.exponentialBackoff(getRunAttempt(), FeatureFlags.getDefaultMaxBackoff()));
} else {
Log.w(TAG, JobLogger.format(this, "Encountered a non-runtime fatal exception."), e);
throw new FailedMigrationError(e);