timeout

fnFuture!T timeout(T)(Future!T input, ref EventLoop loop, long timeoutMs) @trusted

Apply a timeout to a future using an event loop.

If the future completes (resolve, reject, or cancel) before the timeout expires, the result propagates normally. If the timeout fires first, the future is rejected with a timeout error and the original promise is cancelled.

Parameters

inputThe future to apply a timeout to.
loopEvent loop used to schedule the timeout timer.
timeoutMsTimeout duration in milliseconds.

Returns

A Future!T that mirrors input or rejects on timeout.