(with-retry f max-retries)Wraps a function with retry logic that utilizes an exponential backoff with jitter.
The provided function, f, is expected to return a map that includes a :status key.
If the returned status is retryable (as determined by retryable-status?),
the function will wait (using exponential backoff with jitter) and retry the operation.
The process repeats until a non-retryable status is returned or the maximum number of
retries (max-retries) is reached. On each iteration, the attempt count is incremented,
which influences the delay calculation.
Parameters:
:status key.Returns:
A new function wrapping f. When called, it will:
f with the provided arguments.max-retries, wait using the
exponential backoff with jitter and retry.Wraps a function with retry logic that utilizes an exponential backoff with jitter.
The provided function, `f`, is expected to return a map that includes a `:status` key.
If the returned status is retryable (as determined by `retryable-status?`),
the function will wait (using exponential backoff with jitter) and retry the operation.
The process repeats until a non-retryable status is returned or the maximum number of
retries (`max-retries`) is reached. On each iteration, the attempt count is incremented,
which influences the delay calculation.
Parameters:
- f: A function to be executed that returns a map with at least a `:status` key.
- max-retries: The maximum number of retry attempts (non-negative integer).
Returns:
A new function wrapping `f`. When called, it will:
1. Execute `f` with the provided arguments.
2. Check if the result contains a retryable status.
3. If retryable and the attempt count is less than `max-retries`, wait using the
exponential backoff with jitter and retry.
4. Otherwise, return the most recent result.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |