When a job fails, respect the Retry-After header if applicable

This commit is contained in:
Evan Hahn 2021-09-02 17:31:21 -05:00 committed by GitHub
parent c7873dd7ea
commit 1f45bce0a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 228 additions and 30 deletions

View file

@ -90,11 +90,12 @@ export async function runReadOrViewSyncJob({
return;
}
const timeRemaining = timestamp + maxRetryTime - Date.now();
const shouldContinue = await commonShouldJobContinue({
attempt,
log,
maxRetryTime,
timestamp,
timeRemaining,
});
if (!shouldContinue) {
return;
@ -117,6 +118,6 @@ export async function runReadOrViewSyncJob({
})
);
} catch (err: unknown) {
handleCommonJobRequestError(err, log);
await handleCommonJobRequestError({ err, log, timeRemaining });
}
}