diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2019-02-08 16:54:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-08 16:54:13 +0100 |
commit | 216b8aa40f694fddb51c22f5dfc150f6ca578598 (patch) | |
tree | b9b714e56732227447b039b16d1bea04cb73424e /activesupport/lib/active_support | |
parent | 8cae8dcf5473a53179933eee1f0a36db436bbf1e (diff) | |
parent | dda9452314bb904a3e2c850bd23f118eb80e3356 (diff) | |
download | rails-216b8aa40f694fddb51c22f5dfc150f6ca578598.tar.gz rails-216b8aa40f694fddb51c22f5dfc150f6ca578598.tar.bz2 rails-216b8aa40f694fddb51c22f5dfc150f6ca578598.zip |
Merge pull request #34618 from bogdanvlviv/fix-elapsed-time-calculations
Fix elapsed time calculations
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/cache/memory_store.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/notifications/instrumenter.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/cache/memory_store.rb b/activesupport/lib/active_support/cache/memory_store.rb index 106b616529..629eb2dd70 100644 --- a/activesupport/lib/active_support/cache/memory_store.rb +++ b/activesupport/lib/active_support/cache/memory_store.rb @@ -62,13 +62,13 @@ module ActiveSupport return if pruning? @pruning = true begin - start_time = Time.now + start_time = Concurrent.monotonic_time cleanup instrument(:prune, target_size, from: @cache_size) do keys = synchronize { @key_access.keys.sort { |a, b| @key_access[a].to_f <=> @key_access[b].to_f } } keys.each do |key| delete_entry(key, options) - return if @cache_size <= target_size || (max_time && Time.now - start_time > max_time) + return if @cache_size <= target_size || (max_time && Concurrent.monotonic_time - start_time > max_time) end end ensure diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 125c06f37a..00a57c38c9 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -137,7 +137,7 @@ module ActiveSupport private def now - Process.clock_gettime(Process::CLOCK_MONOTONIC) + Concurrent.monotonic_time end if clock_gettime_supported? |