MCPcopy Index your code
hub / github.com/microsoft/TypeChat / getRetryDelayMs

Function getRetryDelayMs

typescript/src/model.ts:287–296  ·  view source on GitHub ↗

* Returns the number of milliseconds to wait before the next retry attempt. * When the response carries a `Retry-After` header (sent by servers on 429 Too Many Requests * and 503 Service Unavailable), its value (in seconds) is used as the delay, capped at * `maxMs` to avoid waiting longer than th

(response: Response, defaultMs: number, maxMs: number)

Source from the content-addressed store, hash-verified

285 * For all other transient errors the default pause is returned.
286 */
287function getRetryDelayMs(response: Response, defaultMs: number, maxMs: number): number {
288 const retryAfter = response.headers.get("retry-after");
289 if (retryAfter) {
290 const seconds = parseInt(retryAfter, 10);
291 if (!isNaN(seconds)) {
292 return Math.min(seconds * 1000, maxMs);
293 }
294 }
295 return defaultMs;
296}
297
298/**
299 * Returns true of the given HTTP status code represents a transient error.

Callers 1

completeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…