Skip to content
On this page

retry

Retries a failed Query with a specified configuration.

Formulae

retry(operation, config) since v0.3

Operation could be a Query or a Mutation.

Config fields:

  • times: number of Store with a number of attempts to retry
  • delay: Sourced Time with an amount of milliseconds to wait before retrying
  • filter: Sourced boolean with a predicate to decide whether to retry or not
  • mapParams?: optional mapper for the Query parameters mapping before the next retry, available overloads:
    • (params, { attempt }) => mapped
    • { source: Store, fn: (params, { attempt }, source) => mapped }
  • otherwise?: Event or Effect, that will be called after the last attempt if the Query is still failed
  • supressIntermediateErrors?: since v0.9 boolean whether to suppress intermediate errors or not, defaults to true. If false, then the Query will be marked as failed after the first fail.

Build-in delays

You can use the following delays:

  • linearDelay(base, opts)
  • exponentialDelay(base, opts)

Options:

  • randomize.spread: number with a randomization spread, defaults to 0

Showcases

Released under the MIT License.