Liking cljdoc? Tell your friends :D

bff.retry

Step-level retry with an optional pre-retry hook.

A step declares retry behaviour under its :retry key:

:retry {:max 2
        :on_code [:unauthorized]
        :before_retry {:key "cmap-token-refresh"}}

The hook is called before each retry attempt with a failure-context map; its return value replaces the request-ctx used for the next call. Common use case: refresh a bearer token and inject it into the Authorization header before the retry.

Step-level retry with an optional pre-retry hook.

A step declares retry behaviour under its `:retry` key:

    :retry {:max 2
            :on_code [:unauthorized]
            :before_retry {:key "cmap-token-refresh"}}

The hook is called before each retry attempt with a failure-context map;
its return value replaces the request-ctx used for the next call. Common
use case: refresh a bearer token and inject it into the Authorization
header before the retry.
raw docstring

apply-before-retryclj

(apply-before-retry retry-cfg failure-context retry-hooks)

Run the before-retry hook if declared, resolving it against retry-hooks (a map "key" → impl). Returns the request-ctx to use for the next attempt — either the hook's return value or the current ctx.

Run the before-retry hook if declared, resolving it against `retry-hooks`
(a map "key" → impl). Returns the request-ctx to use for the next
attempt — either the hook's return value or the current ctx.
sourceraw docstring

BffRetryHookcljprotocol

before-retryclj

(before-retry this failure-context)

Called before a retry attempt. failure-context has :step-id, :attempt (1-indexed retry number), :args, :chain-ctx, :request-ctx, :error. Return a request-ctx map to use for the retry, or nil to reuse the current one.

Called before a retry attempt. `failure-context` has :step-id, :attempt
(1-indexed retry number), :args, :chain-ctx, :request-ctx, :error.
Return a request-ctx map to use for the retry, or nil to reuse the
current one.
source

should-retry?clj

(should-retry? retry-cfg result attempt)

True if the step is configured to retry, the result is an error, its code is in the allowlist, and the retry budget isn't exhausted. attempt is the count of retries already made (0 = the first call just failed).

True if the step is configured to retry, the result is an error, its code
is in the allowlist, and the retry budget isn't exhausted. `attempt` is
the count of retries already made (0 = the first call just failed).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close