lib/async/task.rb in async-2.0.0 vs lib/async/task.rb in async-2.0.1
- old
+ new
@@ -90,12 +90,12 @@
# @deprecated Prefer {Kernel#sleep} except when compatibility with `stable-v1` is required.
def sleep(duration = nil)
super
end
- # @deprecated Replaced by {Scheduler#timeout_after}.
- def with_timeout(timeout, exception = TimeoutError, message = "execution expired", &block)
- Fiber.scheduler.timeout_after(timeout, exception, message, &block)
+ # Execute the given block of code, raising the specified exception if it exceeds the given duration during a non-blocking operation.
+ def with_timeout(duration, exception = TimeoutError, message = "execution expired", &block)
+ Fiber.scheduler.with_timeout(duration, exception, message, &block)
end
# Yield back to the reactor and allow other fibers to execute.
def yield
Fiber.scheduler.yield