aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/notifications
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-08-18 16:52:15 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-08-18 16:52:15 -0700
commit48c8135423dd7a8ff676b858cad6795a15903826 (patch)
treec0fc702334277f2570073bc1eb5903674e2e28f2 /activesupport/lib/active_support/notifications
parentd1b618b50a8af8c10a3a54352f880f9f48351357 (diff)
downloadrails-48c8135423dd7a8ff676b858cad6795a15903826.tar.gz
rails-48c8135423dd7a8ff676b858cad6795a15903826.tar.bz2
rails-48c8135423dd7a8ff676b858cad6795a15903826.zip
duration is called multiple times in dev, so lets cache it
Diffstat (limited to 'activesupport/lib/active_support/notifications')
-rw-r--r--activesupport/lib/active_support/notifications/instrumenter.rb3
1 files changed, 2 insertions, 1 deletions
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)