aboutsummaryrefslogtreecommitdiffstats
path: root/lib/timeout.rb
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-02-12 16:54:52 +1300
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2021-03-30 18:38:42 +1300
commit92449e0e99ae0e44f0deec5e59a7146824872952 (patch)
tree932ebb123a3ad94d532775f6b4316741130744a2 /lib/timeout.rb
parentaf1c587546c34190721bb8b72e86985e9b79bdc6 (diff)
downloadruby-92449e0e99ae0e44f0deec5e59a7146824872952.tar.gz
Fix handling of timeout accessing scheduler outside of non-blocking context.
Diffstat (limited to 'lib/timeout.rb')
-rw-r--r--lib/timeout.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb
index dc8eb24a10..11db4be973 100644
--- a/lib/timeout.rb
+++ b/lib/timeout.rb
@@ -84,7 +84,7 @@ module Timeout
message ||= "execution expired".freeze
- if (scheduler = Fiber.scheduler)&.respond_to?(:timeout_after)
+ if (scheduler = Fiber.current_scheduler)&.respond_to?(:timeout_after)
return scheduler.timeout_after(sec, klass || Error, message, &block)
end