(cb-error-handler CBS
[fail-limit window-nanos]
[open-timeout time-unit]
ex-fn
ex)
Function with which to handle errors in a circuit-breaker context. Typical usage would involve partially binding all but the last arg (the exception itself).
<CBS> - atom holding all the state required (see cb-init
).
<fail-limit> - How many Exceptions (within <window-nanos>) before transitioning from CLOSED => OPEN.
<window-nanos> - Time window (in nanos) in which <fail-limit> has an effect.
<open-timeout> - How long (in <timeout-unit>) to wait before transitioning from OPEN => HALF-OPEN
<timeout-unit> - One of the keys in util/time-units
(defaults to :millis
).
<ex-fn> - Function of 3 args to be called last. Takes the Exception itself (do NOT rethrow),
the time it occurred (per System/nanoTime
) & the current fail count.
Function with which to handle errors in a circuit-breaker context. Typical usage would involve partially binding all but the last arg (the exception itself). <CBS> - atom holding all the state required (see `cb-init`). <fail-limit> - How many Exceptions (within <window-nanos>) before transitioning from CLOSED => OPEN. <window-nanos> - Time window (in nanos) in which <fail-limit> has an effect. <open-timeout> - How long (in <timeout-unit>) to wait before transitioning from OPEN => HALF-OPEN <timeout-unit> - One of the keys in `util/time-units` (defaults to `:millis`). <ex-fn> - Function of 3 args to be called last. Takes the Exception itself (do NOT rethrow), the time it occurred (per `System/nanoTime`) & the current fail count.
(cb-wrap-handler CBS success-limit drop-fn success-block handler)
Given a <handler> fn, returns a wrapped version of it (with circuit-breaker semantics).
<CBS> - atom holding all the state required (see cb-init
).
<success-limit> - How many successful calls before transitioning from HALF-OPEN => CLOSED
<drop-fn> - Function to handle all requests while in OPEN state (arg-list per <handler>).
If a default value makes sense in your domain this is your chance to use it.
<success-block> - Function (or positive integer) expected to produce an artificial delay
(via Thread/sleep
) after each successful <handler> call (arg-list per <handler>).
<handler> - The underlying processing handler function.
Given a <handler> fn, returns a wrapped version of it (with circuit-breaker semantics). <CBS> - atom holding all the state required (see `cb-init`). <success-limit> - How many successful calls before transitioning from HALF-OPEN => CLOSED <drop-fn> - Function to handle all requests while in OPEN state (arg-list per <handler>). If a default value makes sense in your domain this is your chance to use it. <success-block> - Function (or positive integer) expected to produce an artificial delay (via `Thread/sleep`) after each successful <handler> call (arg-list per <handler>). <handler> - The underlying processing handler function.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close