diff options
author | Samuel Williams <[email protected]> | 2021-02-12 16:54:52 +1300 |
---|---|---|
committer | Samuel Williams <[email protected]> | 2021-03-30 18:38:42 +1300 |
commit | 92449e0e99ae0e44f0deec5e59a7146824872952 (patch) | |
tree | 932ebb123a3ad94d532775f6b4316741130744a2 /lib/timeout.rb | |
parent | af1c587546c34190721bb8b72e86985e9b79bdc6 (diff) |
Fix handling of timeout accessing scheduler outside of non-blocking context.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4173
Diffstat (limited to 'lib/timeout.rb')
-rw-r--r-- | lib/timeout.rb | 2 |
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 |