Retry.State.done: def of bend-kit-retry@0.3.0.0 Import: import bend-kit-retry@0.3.0.0/retry.bend as Retry Lines 125-143 of bend-kit-retry@0.3.0.0/retry.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-retry@0.3.0.0/retry.bend&start_line=125&end_line=143 import Base # A closed success clears the failures. A closed failure opens the circuit when the window then holds threshold # failures. A half-open success closes it; a half-open failure opens it again for cooldown. An attempt that ends # while open changes nothing. def State.done(+c: Circuit, s: State, +now: Nat, failed: Bool) -> State: match s: case CircuitClosed{fs}: match failed: case False{}: CircuitClosed{Nil{}} case True{}: closed.fail(c, fs, now) case CircuitOpen{u}: CircuitOpen{u} case CircuitHalf{k}: match failed: case False{}: CircuitClosed{Nil{}} case True{}: CircuitOpen{Nat.add(now, Circuit.cooldown(c))} Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=bend-kit-retry@0.3.0.0/retry.bend&name=Circuit https://jend.leeeet.dev/definition.txt?path=bend-kit-retry@0.3.0.0/retry.bend&name=Circuit.cooldown https://jend.leeeet.dev/definition.txt?path=bend-kit-retry@0.3.0.0/retry.bend&name=State https://jend.leeeet.dev/definition.txt?path=bend-kit-retry@0.3.0.0/retry.bend&name=closed.fail