def settle.op

bend-kit-runner@0.13.0.1 · runner.bend:1299

import bend-kit-runner@0.13.0.1/runner.bend as Runner
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import bend-kit-resources@0.1.0.0/resources.bend as Res
import bend-kit-retry@0.3.0.0/retry.bend as Retry

1299# Tells the target's breaker, appends the outcome's op, and returns the attempt's unit to the pool.
1300# The op of a cancelled ticket changes no state: the queue no longer holds it.
1301def settle.op(~A: Data, ~penc: A -> Bytes.Bytes, +o: Retry.Outcome, b: Retry.Budget, +id: Nat, +key: String, +now: Nat, +rnd: Nat, r: Runner<A>, g: Res.Grant,
1302    err: Out(Unit), next: Runner<A> -> Out(Unit) -> IO(Runner<A> & Out(Bool))) -> IO(Runner<A> & Out(Bool)):
1303  Runner{j, +s, p, +c, ib, fs} = r
1304  Config{pol, circ, idle, every} = c
1305  +old = brk.get(A, s, key)
1306  do IO<Runner<A> & Out(Bool)>:
1307    y : Ran(A) <- trip(~A, ~penc, Runner{j, s, p, c, ib, fs}, key, old, brk.after(circ, old, now, o))
1308    settle.br(~A, ~penc, after(A, o, pol, b, id, fails(tries.get(tries(A, s), id)), now, rnd), y, g, err, next)

Uses (23)

Used by (1)