Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use a thread local rather than a queue so events are in the right order

  • Loading branch information...
commit 45318e4010e4f6303ef740bf159d2803c28acc7a 1 parent ea296fc
@tenderlove tenderlove authored
Showing with 4 additions and 7 deletions.
  1. +4 −7 activesupport/lib/active_support/notifications/fanout.rb
View
11 activesupport/lib/active_support/notifications/fanout.rb
@@ -107,21 +107,18 @@ def matches?(subscriber_or_name)
end
class Timed < Evented
- def initialize(pattern, delegate)
- @timestack = Queue.new
- super
- end
-
def publish(name, *args)
@delegate.call name, *args
end
def start(name, id, payload)
- @timestack.push Time.now
+ timestack = Thread.current[:_timestack] ||= []
+ timestack.push Time.now
end
def finish(name, id, payload)
- started = @timestack.pop
+ timestack = Thread.current[:_timestack]
+ started = timestack.pop
@delegate.call(name, started, Time.now, id, payload)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.