Skip to content

Commit 554660d

Browse files
ioquatixhsbt
authored andcommitted
Fix handling of timeout accessing scheduler outside of non-blocking context.
1 parent d56d025 commit 554660d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/timeout.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def timeout(sec, klass = nil, message = nil, &block) #:yield: +sec+
8484

8585
message ||= "execution expired".freeze
8686

87-
if (scheduler = Fiber.scheduler)&.respond_to?(:timeout_after)
87+
if (scheduler = Fiber.current_scheduler)&.respond_to?(:timeout_after)
8888
return scheduler.timeout_after(sec, klass || Error, message, &block)
8989
end
9090

0 commit comments

Comments
 (0)