RetryWithExponentialBackoffRespectingRetryHeaders
Namespace: Vercel.AI.Util
public sealed class RetryWithExponentialBackoffRespectingRetryHeadersRetries a failed operation with exponential backoff, honoring retry-after-ms and retry-after
when the delay is between 0 and 60 seconds, or shorter than the backoff delay.
Inheritance: object
Constructors
Section titled “Constructors”RetryWithExponentialBackoffRespectingRetryHeaders(RetryOptions?)
Section titled “RetryWithExponentialBackoffRespectingRetryHeaders(RetryOptions?)”public RetryWithExponentialBackoffRespectingRetryHeaders(RetryOptions? options = null)Creates a retry strategy.
Parameters
| Name | Type | Description |
|---|---|---|
options |
RetryOptions |
Methods
Section titled “Methods”ExecuteAsync<T>(Func<Task<T>>)
Section titled “ExecuteAsync<T>(Func<Task<T>>)”public Task<T> ExecuteAsync<T>(Func<Task<T>> operation)Runs <code class=“paramref”>operation</code> until it succeeds or retries stop.
Type parameters
| Name | Description |
|---|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
operation |
Func<Task<T>> |
Returns: Task<T>
GetRetryDelayInMs(object, double, DateTimeOffset?)
Section titled “GetRetryDelayInMs(object, double, DateTimeOffset?)”public static double GetRetryDelayInMs(object error, double exponentialBackoffDelay, DateTimeOffset? utcNow = null)Delay in milliseconds for <code class=“paramref”>error</code> given the current exponential delay. Header delays are used when they are at least 0 and either under 60 seconds or shorter than the backoff.
Parameters
| Name | Type | Description |
|---|---|---|
error |
object | |
exponentialBackoffDelay |
double | |
utcNow |
DateTimeOffset? |
Returns: double
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product