Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(extend ClosedState CircuitBreakerTransitions
{:proceed (constantly true)
(fn [{f :fail-count p :policy, :as s}]
(if (zero? f) s (ClosedState. p 0)))
(fn [{f :fail-count {max-fail :max-fails :as p} :policy, :as s}]
(if (= f max-fail)
(OpenState. p (System/currentTimeMillis))
(assoc s :fail-count (inc f))))}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment