aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache/memory_store.rb
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2019-02-08 16:54:13 +0100
committerGitHub <noreply@github.com>2019-02-08 16:54:13 +0100
commit216b8aa40f694fddb51c22f5dfc150f6ca578598 (patch)
treeb9b714e56732227447b039b16d1bea04cb73424e /activesupport/lib/active_support/cache/memory_store.rb
parent8cae8dcf5473a53179933eee1f0a36db436bbf1e (diff)
parentdda9452314bb904a3e2c850bd23f118eb80e3356 (diff)
downloadrails-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/cache/memory_store.rb')
-rw-r--r--activesupport/lib/active_support/cache/memory_store.rb4
1 files changed, 2 insertions, 2 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