diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-08-18 16:52:15 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-08-18 16:52:15 -0700 |
commit | 48c8135423dd7a8ff676b858cad6795a15903826 (patch) | |
tree | c0fc702334277f2570073bc1eb5903674e2e28f2 /activesupport | |
parent | d1b618b50a8af8c10a3a54352f880f9f48351357 (diff) | |
download | rails-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')
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 3 |
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) |