def retry.after.secs

bend-kit-http@0.38.2.0 · http.bend:4495

import bend-kit-http@0.38.2.0/http.bend as Http
import Base
import bend-kit-time@0.3.0.0/time.bend as Time

4495# More than 5 digits is past the cap, and would overflow parse_u32.
4496def retry.after.secs(+v: String, now: Time.Instant, n: Maybe<&2, U32>) -> Maybe<&2, U32>:
4497  match n:
4498    case None{}:
4499      retry.after.date(Time.http_date.parse(v), now)
4500    case Some{s}:
4501      Some{Bool.pick(U32, Nat.is_lt(5n, String.length(v)), retry.cap(), U32.min((s * 1000 : U32), retry.cap()))}

Uses (12)

Used by (1)