ruby-changes:66085
From: Jeremy <ko1@a...>
Date: Thu, 6 May 2021 17:08:44 +0900 (JST)
Subject: [ruby-changes:66085] 120b835fae (master): [ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler exists
https://git.ruby-lang.org/ruby.git/commit/?id=120b835fae From 120b835fae2832ded4a02d3fcfc70749cad9d177 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Mon, 3 May 2021 08:38:54 -0700 Subject: [ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler exists https://github.com/ruby/timeout/commit/4893cde0ed --- lib/timeout.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/timeout.rb b/lib/timeout.rb index ee24349..e7b11c0 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -85,7 +85,7 @@ module Timeout https://github.com/ruby/ruby/blob/trunk/lib/timeout.rb#L85 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 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/