MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / buildRetryInfo

Function buildRetryInfo

packages/providers/src/retry.ts:272–284  ·  view source on GitHub ↗
(
  attempt: number,
  totalAttempts: number,
  decision: RetryDecision,
  baseDelayMs: number,
)

Source from the content-addressed store, hash-verified

270) => Promise<GenerateResult>;
271
272function buildRetryInfo(
273 attempt: number,
274 totalAttempts: number,
275 decision: RetryDecision,
276 baseDelayMs: number,
277): RetryReason {
278 const backoff = computeDelay(attempt, baseDelayMs);
279 const delayMs =
280 decision.retryAfterMs !== undefined ? Math.max(decision.retryAfterMs, backoff) : backoff;
281 const info: RetryReason = { attempt, totalAttempts, delayMs, reason: decision.reason };
282 if (decision.retryAfterMs !== undefined) info.retryAfterMs = decision.retryAfterMs;
283 return info;
284}
285
286function shouldStop(decision: RetryDecision, attempt: number, maxRetries: number): boolean {
287 return !decision.retry || attempt >= maxRetries;

Callers 1

withBackoffFunction · 0.85

Calls 1

computeDelayFunction · 0.85

Tested by

no test coverage detected