MCPcopy Create free account
hub / github.com/anus-dev/ANUS / getDelayDurationAndStatus

Function getDelayDurationAndStatus

packages/core/src/utils/retry.ts:289–300  ·  view source on GitHub ↗

* Determines the delay duration based on the error, prioritizing Retry-After header. * @param error The error object. * @returns An object containing the delay duration in milliseconds and the error status.

(error: unknown)

Source from the content-addressed store, hash-verified

287 * @returns An object containing the delay duration in milliseconds and the error status.
288 */
289function getDelayDurationAndStatus(error: unknown): {
290 delayDurationMs: number;
291 errorStatus: number | undefined;
292} {
293 const errorStatus = getErrorStatus(error);
294 let delayDurationMs = 0;
295
296 if (errorStatus === 429) {
297 delayDurationMs = getRetryAfterDelayMs(error);
298 }
299 return { delayDurationMs, errorStatus };
300}
301
302/**
303 * Logs a message for a retry attempt when using exponential backoff.

Callers 1

retryWithBackoffFunction · 0.85

Calls 2

getErrorStatusFunction · 0.85
getRetryAfterDelayMsFunction · 0.85

Tested by

no test coverage detected