MCPcopy Create free account
hub / github.com/IIIIQIIII/claude-code / getRetryDelay

Function getRetryDelay

src/services/api/withRetry.ts:526–544  ·  view source on GitHub ↗
(
  attempt: number,
  retryAfterHeader?: string | null,
  maxDelayMs = 32000,
)

Source from the content-addressed store, hash-verified

524}
525
526export function getRetryDelay(
527 attempt: number,
528 retryAfterHeader?: string | null,
529 maxDelayMs = 32000,
530): number {
531 if (retryAfterHeader) {
532 const seconds = parseInt(retryAfterHeader, 10)
533 if (!isNaN(seconds)) {
534 return seconds * 1000
535 }
536 }
537
538 const baseDelay = Math.min(
539 BASE_DELAY_MS * Math.pow(2, attempt - 1),
540 maxDelayMs,
541 )
542 const jitter = Math.random() * 0.25 * baseDelay
543 return baseDelay + jitter
544}
545
546export function parseMaxTokensContextOverflowError(error: APIError):
547 | {

Callers 6

streamCompactSummaryFunction · 0.85
fetchWithRetryFunction · 0.85
fetchWithRetryFunction · 0.85
fetchTeamMemoryFunction · 0.85
withRetryFunction · 0.85
fetchUserSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected