Merge pull request #22107 from overleaf/jpa-error-handling

[history-v1] back_fill_file_hash: error handling

GitOrigin-RevId: 2dbf52d015206cf42ca434b1f16221d6e0f2cc2b
This commit is contained in:
Jakob Ackermann
2024-11-25 13:07:06 +01:00
committed by Copybot
parent 0e12f9226f
commit ed27af11f8
2 changed files with 8 additions and 2 deletions

View File

@@ -140,6 +140,10 @@ async function verifyMd5(persistor, bucket, key, sourceMd5, destMd5 = null) {
}
function wrapError(error, message, params, ErrorType) {
params = {
...params,
cause: error,
}
if (
error instanceof NotFoundError ||
['NoSuchKey', 'NotFound', 404, 'AccessDenied', 'ENOENT'].includes(

View File

@@ -356,7 +356,8 @@ async function processFile(entry, filePath) {
{ err, projectId, fileId, hash, path, attempt },
'failed to process file, trying again'
)
await setTimeout(RETRY_DELAY_MS)
const jitter = Math.random() * RETRY_DELAY_MS
await setTimeout(RETRY_DELAY_MS + jitter)
}
}
return await processFileOnce(entry, filePath)
@@ -1000,7 +1001,8 @@ class ProjectContext {
{ err, projectId: this.projectId, attempt },
'failed to get DEK, trying again'
)
await setTimeout(RETRY_DELAY_MS)
const jitter = Math.random() * RETRY_DELAY_MS
await setTimeout(RETRY_DELAY_MS + jitter)
}
}
}