mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-27 20:03:25 +01:00
When a job fails, respect the Retry-After header if applicable
This commit is contained in:
@@ -3,11 +3,17 @@
|
||||
|
||||
import type { LoggerType } from '../../logging/log';
|
||||
import { parseIntWithFallback } from '../../util/parseIntWithFallback';
|
||||
import { sleepFor413RetryAfterTimeIfApplicable } from './sleepFor413RetryAfterTimeIfApplicable';
|
||||
|
||||
export function handleCommonJobRequestError(
|
||||
err: unknown,
|
||||
log: LoggerType
|
||||
): void {
|
||||
export async function handleCommonJobRequestError({
|
||||
err,
|
||||
log,
|
||||
timeRemaining,
|
||||
}: Readonly<{
|
||||
err: unknown;
|
||||
log: LoggerType;
|
||||
timeRemaining: number;
|
||||
}>): Promise<void> {
|
||||
if (!(err instanceof Error)) {
|
||||
throw err;
|
||||
}
|
||||
@@ -18,5 +24,7 @@ export function handleCommonJobRequestError(
|
||||
return;
|
||||
}
|
||||
|
||||
await sleepFor413RetryAfterTimeIfApplicable({ err, log, timeRemaining });
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user