mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler exists
https://github.com/ruby/timeout/commit/4893cde0ed
This commit is contained in:
parent
44e8575ca6
commit
120b835fae
1 changed files with 1 additions and 1 deletions
|
@ -85,7 +85,7 @@ module Timeout
|
|||
|
||||
message ||= "execution expired".freeze
|
||||
|
||||
if (scheduler = Fiber.current_scheduler)&.respond_to?(:timeout_after)
|
||||
if Fiber.respond_to?(:current_scheduler) && (scheduler = Fiber.current_scheduler)&.respond_to?(:timeout_after)
|
||||
return scheduler.timeout_after(sec, klass || Error, message, &block)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue