When a job fails, respect the Retry-After
header if applicable
This commit is contained in:
parent
c7873dd7ea
commit
1f45bce0a2
12 changed files with 228 additions and 30 deletions
|
@ -10,17 +10,12 @@ import { isDone as isDeviceLinked } from '../../util/registration';
|
|||
export async function commonShouldJobContinue({
|
||||
attempt,
|
||||
log,
|
||||
maxRetryTime,
|
||||
timestamp,
|
||||
timeRemaining,
|
||||
}: Readonly<{
|
||||
attempt: number;
|
||||
log: LoggerType;
|
||||
maxRetryTime: number;
|
||||
timestamp: number;
|
||||
timeRemaining: number;
|
||||
}>): Promise<boolean> {
|
||||
const maxJobAge = timestamp + maxRetryTime;
|
||||
const timeRemaining = maxJobAge - Date.now();
|
||||
|
||||
if (timeRemaining <= 0) {
|
||||
log.info("giving up because it's been too long");
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue