提交 a01d9dae 编写于 作者: A Aaron Patterson

make the fanout notifier local to the current thread

上级 9bda519e
...@@ -138,8 +138,6 @@ module Notifications ...@@ -138,8 +138,6 @@ module Notifications
@instrumenters = Hash.new { |h,k| h[k] = notifier.listening?(k) } @instrumenters = Hash.new { |h,k| h[k] = notifier.listening?(k) }
class << self class << self
attr_accessor :notifier
def publish(name, *args) def publish(name, *args)
notifier.publish(name, *args) notifier.publish(name, *args)
end end
...@@ -173,8 +171,14 @@ def unsubscribe(args) ...@@ -173,8 +171,14 @@ def unsubscribe(args)
def instrumenter def instrumenter
Thread.current[:"instrumentation_#{notifier.object_id}"] ||= Instrumenter.new(notifier) Thread.current[:"instrumentation_#{notifier.object_id}"] ||= Instrumenter.new(notifier)
end 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
end end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册