def timed

bendonnect-rpc@0.1.0.0 · src/transport/server.bend:245

import bendonnect-rpc@0.1.0.0/src/transport/server.bend as Server
import Base

245# NOTE: IO.within does not cancel the loser; a handler that overruns keeps running unobserved.
246def timed(~handle: Call -> IO(Reply), call: Call, t: Maybe<&2, U32>) -> IO(Reply):
247  match t:
248    case None{}:
249      handle(call)
250    case Some{+ms}:
251      do IO<Reply>:
252        m : Maybe<&1, Reply> <- IO.within(Reply, ms, handle(call))
253        return timed.fin(m)

Uses (9)

Used by (1)