From a01d9dae1c06014497096e23d91f8d633a41d178 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 19 Jun 2012 10:06:49 -0700 Subject: make the fanout notifier local to the current thread --- activesupport/lib/active_support/notifications.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index e3d8cf48ce..2e2314cad5 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -138,8 +138,6 @@ module ActiveSupport @instrumenters = Hash.new { |h,k| h[k] = notifier.listening?(k) } class << self - attr_accessor :notifier - def publish(name, *args) notifier.publish(name, *args) end @@ -173,8 +171,14 @@ module ActiveSupport def instrumenter Thread.current[:"instrumentation_#{notifier.object_id}"] ||= Instrumenter.new(notifier) end - end - self.notifier = Fanout.new + def notifier + Thread.current[:notifier] ||= Fanout.new + end + + def notifier=(notifier) + Thread.current[:notifier] = notifier + end + end end end -- cgit v1.2.3