Opt-in retry helper for transient failures.
Scope: wrap a thunk that calls the SDK, retry on transport errors and
5xx responses, leave 4xx alone. NOT composable with write ops at the
caller's discretion — retrying a sync after a timeout could double-
apply if the server processed the first attempt. Use on idempotent
calls (search / get / count / schema / sql-template).
Retryable: :code TRANSPORT_ERROR — network blip, DNS, timeout :code HTTP_ERROR + :status 502/503/504 — gateway / upstream hiccup
NOT retryable (propagates on first failure): :code UNAUTHORIZED / FORBIDDEN — auth problem; retry won't help :code HTTP_ERROR with 4xx — caller bug; retry won't help :code UNKNOWN_ENTITY / operation errors — app-level failures
Opt-in retry helper for transient failures. Scope: wrap a thunk that calls the SDK, retry on transport errors and 5xx responses, leave 4xx alone. NOT composable with write ops at the caller's discretion — retrying a `sync` after a timeout could double- apply if the server processed the first attempt. Use on idempotent calls (search / get / count / schema / sql-template). Retryable: :code TRANSPORT_ERROR — network blip, DNS, timeout :code HTTP_ERROR + :status 502/503/504 — gateway / upstream hiccup NOT retryable (propagates on first failure): :code UNAUTHORIZED / FORBIDDEN — auth problem; retry won't help :code HTTP_ERROR with 4xx — caller bug; retry won't help :code UNKNOWN_ENTITY / operation errors — app-level failures
Opt-in retry helper for transient failures in the browser SDK.
Scope matches the CLJ sibling: wrap a promise-returning thunk, retry transport errors and 5xx responses, leave 4xx alone. Use only on idempotent calls.
Retryable: :code TRANSPORT_ERROR — network blip, DNS, timeout :code HTTP_ERROR + :status 502/503/504 — gateway / upstream hiccup
NOT retryable (propagates on first failure): :code UNAUTHORIZED / FORBIDDEN — auth problem :code HTTP_ERROR with 4xx — caller bug app-level failures
Opt-in retry helper for transient failures in the browser SDK. Scope matches the CLJ sibling: wrap a promise-returning thunk, retry transport errors and 5xx responses, leave 4xx alone. Use only on idempotent calls. Retryable: :code TRANSPORT_ERROR — network blip, DNS, timeout :code HTTP_ERROR + :status 502/503/504 — gateway / upstream hiccup NOT retryable (propagates on first failure): :code UNAUTHORIZED / FORBIDDEN — auth problem :code HTTP_ERROR with 4xx — caller bug app-level failures
(with-retry thunk)(with-retry thunk
{:keys [max-attempts backoff-ms max-backoff-ms on-retry]
:or {max-attempts 3 backoff-ms 500 max-backoff-ms 10000}})Invoke thunk (0-arg). On transient failures, sleep + retry up to
:max-attempts times (default 3). Backoff is exponential starting
at :backoff-ms (default 500) — 500, 1000, 2000, ... capped at
:max-backoff-ms (default 10000).
:on-retry (optional) — (fn [attempt ^Throwable delay-ms]) called
between attempts; good for logging.
Returns the thunk's value on success. Throws the last exception if all attempts fail, OR the original exception if it's not retryable.
Invoke `thunk` (0-arg). On transient failures, sleep + retry up to `:max-attempts` times (default 3). Backoff is exponential starting at `:backoff-ms` (default 500) — 500, 1000, 2000, ... capped at `:max-backoff-ms` (default 10000). `:on-retry` (optional) — (fn [attempt ^Throwable delay-ms]) called between attempts; good for logging. Returns the thunk's value on success. Throws the last exception if all attempts fail, OR the original exception if it's not retryable.
Invoke thunk (0-arg, promise-returning). Retry transient failures
up to :max-attempts (default 3) with exponential backoff starting
at :backoff-ms (default 500), capped at :max-backoff-ms (default
10000).
:on-retry — optional (fn [attempt error delay-ms]) for logging.
Returns a promise of the thunk's value. Rejects with the last error if all attempts fail or with the original error if not retryable.
Invoke `thunk` (0-arg, promise-returning). Retry transient failures up to `:max-attempts` (default 3) with exponential backoff starting at `:backoff-ms` (default 500), capped at `:max-backoff-ms` (default 10000). `:on-retry` — optional (fn [attempt error delay-ms]) for logging. Returns a promise of the thunk's value. Rejects with the last error if all attempts fail or with the original error if not retryable.
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 |