def retry.after.secs

bend-kit-http@0.38.5.0 · http.bend:4499

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

4499# More than 5 digits is past the cap, and would overflow parse_u32.
4500def retry.after.secs(+v: String, now: Time.Instant, n: Maybe<&2, U32>) -> Maybe<&2, U32>:
4501  match n:
4502    case None{}:
4503      retry.after.date(Time.http_date.parse(v), now)
4504    case Some{s}:
4505      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)