Permalink
Browse files

make the fanout notifier local to the current thread

  • Loading branch information...
1 parent 9bda519 commit a01d9dae1c06014497096e23d91f8d633a41d178 @tenderlove tenderlove committed Jun 19, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 activesupport/lib/active_support/notifications.rb
@@ -138,8 +138,6 @@ module Notifications
@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 @@ def unsubscribe(args)
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

0 comments on commit a01d9da

Please sign in to comment.