make the fanout notifier local to the current thread

This commit is contained in:
Aaron Patterson 2012-06-19 10:06:49 -07:00
parent 9bda519e95
commit a01d9dae1c

@ -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
def notifier
Thread.current[:notifier] ||= Fanout.new
end
self.notifier = Fanout.new
def notifier=(notifier)
Thread.current[:notifier] = notifier
end
end
end
end