Fix runAttempt not updating in job cache.

Thank you to @valldrac for finding this and diagnosing it!

Fixes #13679
This commit is contained in:
Greyson Parrelli
2024-09-09 19:29:52 -04:00
committed by Cody Henthorne
parent 7835b1d1fc
commit cb126a2f08
2 changed files with 10 additions and 8 deletions

View File

@@ -200,12 +200,14 @@ class FastJobStorage(private val jobDatabase: JobDatabase) : JobStorage {
if (job == null || !job.isMemoryOnly) {
jobDatabase.updateJobAfterRetry(id, currentTime, runAttempt, nextBackoffInterval, serializedData)
// Note: All other fields are accounted for in the min spec. We only need to update from disk if serialized data changes.
// Note: Serialized data and run attempt are the only JobSpec-specific fields that need to be updated -- the rest are in MinimalJobSpec and will be
// updated below.
val cached = jobSpecCache[id]
if (cached != null && !cached.serializedData.contentEquals(serializedData)) {
jobDatabase.getJobSpec(id)?.let {
jobSpecCache[id] = it
}
if (cached != null) {
jobSpecCache[id] = cached.copy(
serializedData = serializedData,
runAttempt = runAttempt
)
}
}