We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent acb0e9c commit 6f3f4f7Copy full SHA for 6f3f4f7
1 file changed
scripts/dev/discord-acp-plain-language-smoke.ts
@@ -543,7 +543,14 @@ async function requestDiscordJson<T>(params: {
543
onTimeout: () => controller.abort(),
544
})) as { retry_after?: number };
545
const waitSeconds = typeof body.retry_after === "number" ? body.retry_after : 1;
546
- await sleepImpl(Math.min(Math.ceil(waitSeconds * 1000), remainingTimeoutMs(deadlineMs)));
+ const waitMs = Math.ceil(waitSeconds * 1000);
547
+ const remainingMs = remainingTimeoutMs(deadlineMs);
548
+ if (waitMs >= remainingMs) {
549
+ throw new Error(
550
+ `${params.errorPrefix} ${params.method} ${redactDiscordApiPath(params.path)} exceeded total timeout before retry.`,
551
+ );
552
+ }
553
+ await sleepImpl(waitMs);
554
continue;
555
}
556
0 commit comments