Usage.within.ceiling: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/policy/usage.bend as Usage Lines 156-165 of cswap-bend-cli@0.1.0.0/policy/usage.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/policy/usage.bend&start_line=156&end_line=165 import Base import cswap-bend-cli@0.1.0.0/policy/types.bend as T # How long a failing row's reading may be trusted. After an http-429 the # account's windows did not move, so the reading is a valid lower bound until # the soonest window resets: now < min(earliest reset, fetched_at + 7200 s). # Any other failure is no evidence the reading still holds: at most 3600 s. def within.ceiling(+e: T.ErrKind, +age: Nat, +now: Nat, +soonest: Maybe<&2, Nat>) -> Bool: match e: case T.ErrHttp429{}: Nat.is_lt(age, 7200n) && soon.ok(now, soonest) case o: Nat.is_le(age, 3600n) 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=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_lt https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/policy/types.bend&name=ErrKind https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/policy/usage.bend&name=soon.ok