Retry

Configure retries to increase reliability.

By default, the router retries GraphQL operation of type Query on specific network errors and HTTP status codes (502, 503, 504, 429). We don't retry after the body is consumed. The default retry strategy is Backoff and Jitter. You can read more about our default retry strategy on the AWS Architecture Blog.

# config.yaml

# See https://cosmo-docs.wundergraph.com/router/configuration#config-file
# for the full list of configuration options.

traffic_shaping:
  all: # Rules are applied to all subgraph requests.
    retry: # Rule is only applied to GraphQL operations of type "query"
      enabled: true
      algorithm: "backoff_jitter"
      max_attempts: 5
      interval: 3s
      max_duration: 10s
  • enabled: Enables the retry mechanism for GraphQL query operations.

  • algorithm: Select the algorithm for the retry. Currently, only backoff_jitter is supported. Additional fields depend on the algorithm selection:

  • backoff_jitter

    • max_attempts: The maximum number of attempts before the operation is considered a failure.

    • interval: The time duration between each retry attempt. Increase with every retry.

    • max_duration: The maximum allowable duration between retries (random).

Debugging

You can see the attempts by enabling debug mode.

Mutations won't be retried because they aren't idempotent.

Last updated