Liking cljdoc? Tell your friends :D

com.potetm.fusebox.cljs.circuit-breaker


currentcljs

(current {cb :com.potetm.fusebox.cljs.circuit-breaker/circuit-breaker})

The current circuit breaker state. Useful for diagnostics or testing.

The current circuit breaker state. Useful for diagnostics or testing.
sourceraw docstring

disablecljs

(disable spec)
source

fail-pctcljs

(fail-pct r)

The percent of calls currently tracked by the circuit breaker which are failed.

The percent of calls currently tracked by the circuit breaker which are failed.
sourceraw docstring

initcljs

(init {_ns :com.potetm.fusebox.cljs.circuit-breaker/next-state
       hs :com.potetm.fusebox.cljs.circuit-breaker/hist-size
       _hot :com.potetm.fusebox.cljs.circuit-breaker/half-open-tries
       _scm :com.potetm.fusebox.cljs.circuit-breaker/slow-call-ms
       succ? :com.potetm.fusebox.cljs.circuit-breaker/success?
       :as spec})

Initialize a circuit breaker.

spec is a map containing: ::next-state - fn taking the current circuit breaker and returning the next state or nil if no transition is necessary. See next-state:default for a default implementation. Return value must be one of: ::closed, ::half-opened, ::opened ::hist-size - The number of calls to track ::half-open-tries - The number of calls to allow in a ::half-open state ::slow-call-ms - Milli threshold to label a call slow ::success? - A function which takes a return value and determines whether it was successful. If false, a ::failure is recorded.

Initialize a circuit breaker.

spec is a map containing:
  ::next-state - fn taking the current circuit breaker and returning the next
                 state or nil if no transition is necessary. See next-state:default
                 for a default implementation. Return value must be one of:
                 ::closed, ::half-opened, ::opened
  ::hist-size       - The number of calls to track
  ::half-open-tries - The number of calls to allow in a ::half-open state
  ::slow-call-ms    - Milli threshold to label a call slow
  ::success?        - A function which takes a return value and determines
                      whether it was successful. If false, a ::failure is
                      recorded.
sourceraw docstring

next-state:defaultcljs

(next-state:default opts r)

A default ::next-state implementation.

  • :fail-pct - The decimal threshold to use to open the breaker due to failed calls (0, 1]
  • :slow-pct - The decimal threshold to use to open the breaker due to slow calls (0, 1]
  • :wait-for-count - The number of calls to wait for after transitioning before transitioning again
  • :open->half-open-after-ms - Millis to wait before transitioning from ::opened to ::half-opened
A default ::next-state implementation.

* :fail-pct - The decimal threshold to use to open the breaker due to failed calls (0, 1]
* :slow-pct - The decimal threshold to use to open the breaker due to slow calls (0, 1]
* :wait-for-count - The number of calls to wait for after transitioning before transitioning again
* :open->half-open-after-ms - Millis to wait before transitioning from ::opened to ::half-opened
sourceraw docstring

record!cljs

(record! spec res duration-ms)
source

should-close?cljs

(should-close? r wait-for fail-threshold slow-threshold)

Default implementation for determining whether to transition to a ::closed state.

Default implementation for determining whether to transition to a ::closed state.
sourceraw docstring

should-open?cljs

(should-open? r wait-for fail-threshold slow-threshold)

Default implementation for determining whether to transition to a ::opened state.

Default implementation for determining whether to transition to a ::opened state.
sourceraw docstring

shutdowncljs

(shutdown spec)
source

slow-pctcljs

(slow-pct r)

The percent of calls currently tracked by the circuit breaker which are slow.

The percent of calls currently tracked by the circuit breaker which are slow.
sourceraw docstring

slow|fail-pctcljs

(slow|fail-pct r)

The percent of calls currently tracked by the circuit breaker which are either slow or failed.

The percent of calls currently tracked by the circuit breaker which are either
slow or failed.
sourceraw docstring

time-expired?cljs

(time-expired? r duration-ms)

Has the provided duration-ms (in millis) expired since the last state transition for this circuit breaker?

Has the provided duration-ms (in millis) expired since the last state transition
for this circuit breaker?
sourceraw docstring

transitioncljs

(transition spec state)
source

with-circuit-breakerclj/smacro

(with-circuit-breaker spec & body)

Evaluates body which returns a promise, guarded by the provided circuit breaker.

Evaluates body which returns a promise, guarded by the provided circuit
breaker.
sourceraw docstring

with-circuit-breaker*cljs

(with-circuit-breaker*
  {cb :com.potetm.fusebox.cljs.circuit-breaker/circuit-breaker
   succ? :com.potetm.fusebox.cljs.circuit-breaker/success?
   :as spec}
  f)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close