Fix backoff interval scheduling for jobs.

This commit is contained in:
Greyson Parrelli
2023-09-18 12:06:42 -04:00
parent bc8eb44a53
commit 8bad476315
6 changed files with 16 additions and 12 deletions

View File

@@ -213,12 +213,13 @@ class JobDatabase(
}
@Synchronized
fun updateJobAfterRetry(id: String, isRunning: Boolean, runAttempt: Int, nextBackoffInterval: Long, serializedData: ByteArray?) {
fun updateJobAfterRetry(id: String, currentTime: Long, runAttempt: Int, nextBackoffInterval: Long, serializedData: ByteArray?) {
writableDatabase
.update(Jobs.TABLE_NAME)
.values(
Jobs.IS_RUNNING to if (isRunning) 1 else 0,
Jobs.IS_RUNNING to 0,
Jobs.RUN_ATTEMPT to runAttempt,
Jobs.LAST_RUN_ATTEMPT_TIME to currentTime,
Jobs.NEXT_BACKOFF_INTERVAL to nextBackoffInterval,
Jobs.SERIALIZED_DATA to serializedData
)