The throttling options, as defined by createThrottle, extended with the retry budget
Optional Readonlyattempts?: numberThe maximum number of attempts per exchange; 0 means no limit; defaults to 1, that is to
a single attempt with no retries
A Middleware wrapping a Fetch implementation with one pacing every exchange and retrying transient failures
Error If any option is out of range
Creates a middleware pacing exchanges and retrying transient failures.
Decorates a Fetch implementation with one holding each exchange until an adaptive throttle grants it, so that a client keeps to the rate its target is willing to serve without the call sites having to coordinate. Every exchange routed through the middleware shares a single throttle, whose baseline delay adapts to what the server replies:
Retry-Afterheader field, in either the delta seconds or the HTTP date form, sets the delay outrightExchanges failing on a transient status, that is
408,429or any5xx, are retried as the throttle directs, up toattemptstimes; every other unsuccessful exchange, and the last attempt of an exhausted one, is relayed to the caller as it stands, so that status handling stays with the consumer.A response stating a proxy error in its
Proxy-Statusfield, as answered by a gateway along the path or by resolve for a failed exchange, is retried on the error type rather than on the status: only failures the path may recover from, such as refused or reset connections, timeouts and unavailable destinations, are retried, while permanent ones, such as DNS names not found and certificate failures, are relayed as they stand.Declare this middleware before resolve, so that exchanges failing in the transport reach it as synthetic responses and the transient ones are retried: declared after it, they reach it as rejections, which are relayed without being retried.
Retries are driven by responses, so this middleware is to be declared after any middleware converting responses into rejections, as reject does: a failure already raised as a Problem is no longer a response and is relayed to the caller without being retried.
attemptsset to0retries a transient failure indefinitely, until the exchange either succeeds or fails on a status that isn't retried.