Liking cljdoc? Tell your friends :D

wagoe.platform.resilience

Retry and circuit breaker for outbound calls — the RPC client and the libs/external adapters both go through here.

Outside shell/ for the reason wagoe.platform.database is: other modules call it, and reaching into platform's shell is what bb check:ports refuses.

Both take predicates over a result rather than deciding what counts as a failure. Only the caller knows whether a second attempt could run something twice.

Retry and circuit breaker for outbound calls — the RPC client and the
libs/external adapters both go through here.

Outside `shell/` for the reason `wagoe.platform.database` is: other modules
call it, and reaching into platform's shell is what `bb check:ports` refuses.

Both take predicates over a result rather than deciding what counts as a
failure. Only the caller knows whether a second attempt could run something
twice.
raw docstring

callclj

(call {:keys [policy cache breaker circuit]}
      {:keys [retryable? failure? on-open] :as opts}
      f)

with-retry inside with-breaker, under settings: (f attempt) is retried while retryable?, and the last result counts against the circuit when failure?. Returns that result, or (on-open retry-after-ms).

`with-retry` inside `with-breaker`, under `settings`: `(f attempt)` is
retried while `retryable?`, and the last result counts against the circuit
when `failure?`. Returns that result, or `(on-open retry-after-ms)`.
sourceraw docstring

settingsclj

(settings {:keys [cache circuit-breaker]} policy circuit timeout-ms)

Retry and breaker settings for calls to circuit.

timeout-ms is one attempt's longest wait: the probe lease must outlive a whole run of attempts, or it expires mid-probe and a second caller sends a second probe. Throws on an invalid :circuit-breaker — an inert breaker looks exactly like a working one.

Retry and breaker settings for calls to `circuit`.

`timeout-ms` is one attempt's longest wait: the probe lease must outlive a
whole run of attempts, or it expires mid-probe and a second caller sends a
second probe. Throws on an invalid `:circuit-breaker` — an inert breaker
looks exactly like a working one.
sourceraw docstring

with-breakerclj

(with-breaker cache config circuit failure? on-open f)

Call (f) unless the breaker for circuit is open; record the outcome.

With no cache there is no breaker and f always runs. When open, returns (on-open retry-after-ms) without calling f. failure? decides whether a result counts against the circuit — count each call once, after its retries, or a threshold of 5 trips on the second call.

config is the :breaker of settings.

Call `(f)` unless the breaker for `circuit` is open; record the outcome.

With no `cache` there is no breaker and `f` always runs. When open, returns
`(on-open retry-after-ms)` without calling `f`. `failure?` decides whether a
result counts against the circuit — count each call once, after its retries,
or a threshold of 5 trips on the second call.

`config` is the `:breaker` of `settings`.
sourceraw docstring

with-retryclj

(with-retry policy retryable? f & [{:keys [on-retry on-give-up]}])

Call (f attempt) (1-based) until retryable? rejects its result or policy runs out of attempts, sleeping retry/delay-ms in between. Returns the last result.

:on-retry gets [result attempt delay-ms] before each sleep, and :on-give-up [result attempts] when a retryable result is the last.

Call `(f attempt)` (1-based) until `retryable?` rejects its result or
`policy` runs out of attempts, sleeping `retry/delay-ms` in between.
Returns the last result.

`:on-retry` gets `[result attempt delay-ms]` before each sleep, and
`:on-give-up` `[result attempts]` when a retryable result is the last.
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