Restate Typescript SDK
    Preparing search index...

    Policy controlling automatic retries of ambiguous ingress failures.

    Retries are opt-in: they happen only when a policy is configured (see ConnectionOpts.retry) and the request is safe to repeat. Regular calls require an idempotencyKey (see IngressCallOptions.idempotencyKey); workflow submissions are idempotent by workflow ID, while workflow attaches and output retrieval only observe the existing workflow.

    By default the following failures are retried: network errors (the underlying fetch rejecting) and responses with a transient status (408, 425, 429, or 5xx). A terminal error of the invocation is never retried, whatever its status code. Override all of this with RetryPolicy.shouldRetry.

    interface RetryPolicy {
        exponentiationFactor?: number;
        initialInterval?: number | Duration;
        maxAttempts?: number | false;
        maxDuration?: number | false | Duration;
        maxInterval?: number | Duration;
        respectRetryAfter?: boolean;
        shouldRetry?: (failure: RetryFailure, attempt: number) => boolean;
    }
    Index

    Properties

    exponentiationFactor?: number

    Exponentiation factor to use when computing the next retry delay. Defaults to 2.

    initialInterval?: number | Duration

    Initial backoff interval. If a number is provided, it is interpreted as milliseconds. Defaults to 250 milliseconds.

    maxAttempts?: number | false

    Max number of attempts (including the initial), before giving up.

    Retrying stops as soon as either maxDuration or maxAttempts is reached.

    Defaults to 6 (the initial attempt plus up to 5 retries). Pass false to remove the attempt bound.

    maxDuration?: number | false | Duration

    Max total duration of retries, measured from the first attempt, before giving up. If a number is provided, it is interpreted as milliseconds.

    This bound is checked only when deciding whether to start another attempt after a failure: it never aborts an in-flight request.

    Retrying stops as soon as either maxDuration or maxAttempts is reached.

    Defaults to 60 seconds. Pass false to remove the duration bound.

    maxInterval?: number | Duration

    Maximum backoff interval. If a number is provided, it is interpreted as milliseconds. Defaults to 3000 milliseconds.

    respectRetryAfter?: boolean

    Whether to honor a Retry-After response header when the server provides one. When true (the default), a Retry-After value overrides the computed exponential backoff for that attempt.

    Set to false to always use the exponential backoff and ignore the header.

    Note that Retry-After never extends the number of retries: maxAttempts and maxDuration is always respected regardless of this setting.

    Defaults to true.

    shouldRetry?: (failure: RetryFailure, attempt: number) => boolean

    Decide whether a given failure should be retried. When provided, this fully replaces the built-in rule (network / transient 408/425/429/5xx, excluding invocation-sourced errors).

    The idempotency-key gate still applies to regular invocations; workflow submissions, attaches, and output retrieval remain eligible without an idempotency key. The maxAttempts cap applies to all of them. This predicate only narrows or broadens which failures are retryable within those bounds. Compose with the built-in rule via the exported defaultShouldRetry.

    Type Declaration

      • (failure: RetryFailure, attempt: number): boolean
      • Parameters

        • failure: RetryFailure

          the failure being considered

        • attempt: number

          the zero-based index of the attempt that just failed

        Returns boolean