class Async::Scheduler
def timeout_after(duration, exception, message, &block)
@parameter message [String] The message to pass to the exception.
@parameter exception [Class] The exception class to raise.
@parameter duration [Numeric] The time in seconds, in which the task should complete.
@asynchronous May raise an exception at any interruption point (e.g. blocking operations).
@public Since *Async v1* and *Ruby v3.1*. May be invoked from `Timeout.timeout`.
Invoke the block, but after the specified timeout, raise the specified exception with the given message. If the block runs to completion before the timeout occurs or there are no non-blocking operations after the timeout expires, the code will complete without any exception.
def timeout_after(duration, exception, message, &block) with_timeout(duration, exception, message) do yield duration end end