diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-06-19 10:06:49 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-06-19 10:37:50 -0700 |
commit | a01d9dae1c06014497096e23d91f8d633a41d178 (patch) | |
tree | 0dd650d55f1f06f24b672c90f618c2f8380d8140 /activesupport | |
parent | 9bda519e95c64dc4d9161400955eb00db8986ea6 (diff) | |
download | rails-a01d9dae1c06014497096e23d91f8d633a41d178.tar.gz rails-a01d9dae1c06014497096e23d91f8d633a41d178.tar.bz2 rails-a01d9dae1c06014497096e23d91f8d633a41d178.zip |
make the fanout notifier local to the current thread
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/notifications.rb | 12 |
1 files changed, 8 insertions, 4 deletions
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 |