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

subscribers are per thread, so remove the nested hash access

上级 0b381521
......@@ -88,9 +88,7 @@ def matches?(subscriber_or_name)
class Timed < Evented
def initialize(pattern, delegate)
@timestack = Hash.new { |h,id|
h[id] = Hash.new { |ids,name| ids[name] = [] }
}
@timestack = []
super
end
......@@ -99,11 +97,11 @@ def publish(name, *args)
end
def start(name, id, payload)
@timestack[id][name].push Time.now
@timestack.push Time.now
end
def finish(name, id, payload)
started = @timestack[id][name].pop
started = @timestack.pop
@delegate.call(name, started, Time.now, id, payload)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册