def poll_due

cswap-bend-cli@0.1.0.0 · policy/usage.bend:312

import cswap-bend-cli@0.1.0.0/policy/usage.bend as Usage
import Base
import cswap-bend-cli@0.1.0.0/policy/types.bend as T

312# Is this row due a fetch on a scheduled auto tick? Never inside backoff,
313# dead (one auth strike), held or claimed; then the plan or staleness decides.
314def poll_due(+u: T.Usage, +now: Nat, +cfg: T.Config) -> Bool:
315  match u:
316    case T.Usage{slot, five, fr, seven, sr, ss, fa, +bo, er, nfl, np, pi, ad, hu, cu, se}:
317      match cfg:
318        case T.Config{thr, ms, st, iv, cd, hy, ttl, ut, ia}:
319          poll.gate(
320            Nat.is_lt(now, bo) || Nat.is_ge(ad, 1n) || Nat.is_lt(now, hu) || Nat.is_lt(now, cu),
321            poll.ready(np, now, pi, fa, ttl)
322          )

Uses (9)

Used by (1)