Retries with Backoff

Pro Feature

This feature is only available on paid plans. Please schedule a demo or email us to get started.

Fern SDKs will automatically retry failed requests with exponential backoff. A request will be retried as long as the request is deemed retriable and the number of retry attempts has not grown larger than the configured retry limit.

Retriable status codes

A request is deemed retriable when any of the following HTTP status codes is returned:

  • 408 (Timeout)
  • 429 (Too Many Requests)
  • 5XX (Internal Server Errors)

Note that you can configure the list of retriable status codes as well. For example, if you want to remove the 429 status code from the list of retriable status codes, you can do so.

Overriding the retry limit

By default, the SDK will retry a failed request up to 2 times. SDK users can override the global default retry limit when instantiating the client.

1import { ImdbClient } from "imdb";
2
3const client = new ImdbClient({
4 maxRetries: 1 // overrides the default retry limit to 1
5});

It’s also possible to override the retry limit on a per-request basis.

1 client.movie.get("tt0111161", {
2 maxRetries: 3 // overrides the default retry limit to 3
3 });