aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorSenya <senya@riseup.net>2019-07-24 22:39:15 +0300
committerSenya <senya@riseup.net>2019-07-24 22:42:24 +0300
commit56ec504db6c130d448ffc1d68c9fdd95fdfc1130 (patch)
treee639d73ef40f242dcdd798bca83a7d11488a2d1e /activesupport/lib
parent01a28f3e6bf9f1550aca9b86b8805051c97a14d6 (diff)
downloadrails-56ec504db6c130d448ffc1d68c9fdd95fdfc1130.tar.gz
rails-56ec504db6c130d448ffc1d68c9fdd95fdfc1130.tar.bz2
rails-56ec504db6c130d448ffc1d68c9fdd95fdfc1130.zip
Make ActiveSupport::Logger Fiber-safe
Use Fiber.current.__id__ in ActiveSupport::Logger#local_level= in order to make log level local to Ruby Fibers in addition to Threads.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/logger_thread_safe_level.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/logger_thread_safe_level.rb b/activesupport/lib/active_support/logger_thread_safe_level.rb
index f16c90cfc6..1775a41492 100644
--- a/activesupport/lib/active_support/logger_thread_safe_level.rb
+++ b/activesupport/lib/active_support/logger_thread_safe_level.rb
@@ -3,6 +3,7 @@
require "active_support/concern"
require "active_support/core_ext/module/attribute_accessors"
require "concurrent"
+require "fiber"
module ActiveSupport
module LoggerThreadSafeLevel # :nodoc:
@@ -28,7 +29,7 @@ module ActiveSupport
end
def local_log_id
- Thread.current.__id__
+ Fiber.current.__id__
end
def local_level