aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-04-30 16:58:30 -0500
committerGitHub <noreply@github.com>2019-04-30 16:58:30 -0500
commit84572fe26785eac8b00ab4db0ba12f23978be3ce (patch)
treeeafa11e23849f9aef6c59812494a864ab440fdd0
parent681b0c1f2a2a51becad928ff157d59082ce5c1bd (diff)
parentb9a9131fdb1a3e8aad7a18741c84f16ac33ddeaf (diff)
downloadrails-84572fe26785eac8b00ab4db0ba12f23978be3ce.tar.gz
rails-84572fe26785eac8b00ab4db0ba12f23978be3ce.tar.bz2
rails-84572fe26785eac8b00ab4db0ba12f23978be3ce.zip
Merge pull request #36148 from ksolo/update-event-duration-in-notifications
Revert changes to monotonic times
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb4
-rw-r--r--activesupport/test/notifications_test.rb7
2 files changed, 5 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index 8812b67f63..c506b35b1e 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -180,13 +180,13 @@ module ActiveSupport
def start(name, id, payload)
timestack = Thread.current[:_timestack] ||= []
- timestack.push Concurrent.monotonic_time
+ timestack.push Time.now
end
def finish(name, id, payload)
timestack = Thread.current[:_timestack]
started = timestack.pop
- @delegate.call(name, started, Concurrent.monotonic_time, id, payload)
+ @delegate.call(name, started, Time.now, id, payload)
end
end
diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb
index 0af59764b5..d3c660a014 100644
--- a/activesupport/test/notifications_test.rb
+++ b/activesupport/test/notifications_test.rb
@@ -302,7 +302,7 @@ module Notifications
class EventTest < TestCase
def test_events_are_initialized_with_details
- time = Concurrent.monotonic_time
+ time = Time.now
event = event(:foo, time, time + 0.01, random_id, {})
assert_equal :foo, event.name
@@ -310,12 +310,11 @@ module Notifications
assert_in_delta 10.0, event.duration, 0.00001
end
- def test_event_cpu_time_and_idle_time_when_start_and_finish_is_not_called
- time = Concurrent.monotonic_time
+ def test_event_cpu_time_does_not_raise_error_when_start_or_finished_not_called
+ time = Time.now
event = event(:foo, time, time + 0.01, random_id, {})
assert_equal 0, event.cpu_time
- assert_in_delta 10.0, event.idle_time, 0.00001
end