From 48c8135423dd7a8ff676b858cad6795a15903826 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 18 Aug 2013 16:52:15 -0700 Subject: duration is called multiple times in dev, so lets cache it --- activesupport/lib/active_support/notifications/instrumenter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (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 0c9a729ce5..3a244b34b5 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -54,10 +54,11 @@ module ActiveSupport @transaction_id = transaction_id @end = ending @children = [] + @duration = nil end def duration - 1000.0 * (self.end - time) + @duration ||= 1000.0 * (self.end - time) end def <<(event) -- cgit v1.2.3