lib/mini_profiler/storage/memory_store.rb in rack-mini-profiler-0.10.7 vs lib/mini_profiler/storage/memory_store.rb in rack-mini-profiler-1.0.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Rack class MiniProfiler class MemoryStore < AbstractStore # Sub-class thread so we have a named thread (useful for debugging in Thread.list). @@ -48,11 +50,11 @@ def initialize(args = nil) args ||= {} @expires_in_seconds = args.fetch(:expires_in) { EXPIRES_IN_SECONDS } - @token1, @token2, @cycle_tokens_at = nil + @token1, @token2, @cycle_at = nil initialize_locks initialize_cleanup_thread(args) end @@ -66,10 +68,10 @@ #FIXME: use weak ref, trouble it may be broken in 1.9 so need to use the 'ref' gem def initialize_cleanup_thread(args={}) cleanup_interval = args.fetch(:cleanup_interval) { CLEANUP_INTERVAL } cleanup_cycle = args.fetch(:cleanup_cycle) { CLEANUP_CYCLE } - t = CacheCleanupThread.new(cleanup_interval, cleanup_cycle, self) do |t| + t = CacheCleanupThread.new(cleanup_interval, cleanup_cycle, self) do until Thread.current[:should_exit] do CacheCleanupThread.current.sleepy_run end end at_exit { t[:should_exit] = true }