From ff0d842454571d78addd1fe9d4f232b600881b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 25 Jul 2010 20:46:42 +0200 Subject: Revert the previous three commits. * AS::Notifications#instrument should not measure anything, it is not its responsibility; * Adding another argument to AS::Notifications#instrument API needs to be properly discussed; --- .../lib/active_support/notifications/instrumenter.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'activesupport/lib/active_support/notifications') diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 4fc446fb2b..441fefb491 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -14,19 +14,16 @@ module ActiveSupport # Instrument the given block by measuring the time taken to execute it # and publish it. Notice that events get sent even if an error occurs # in the passed-in block - def instrument(name, payload={}, info = nil) + def instrument(name, payload={}) + started = Time.now + begin - started = Time.now yield rescue Exception => e payload[:exception] = [e.class.name, e.message] raise e ensure - finished = Time.now - if info - info[:elapsed] = 1000.0 * (finished.to_f - started.to_f) - end - @notifier.publish(name, started, finished, @id, payload) + @notifier.publish(name, started, Time.now, @id, payload) end end -- cgit v1.2.3