• David H. Wilkins's avatar
    Stop environments from needless refreshes · 4692abaa
    David H. Wilkins authored
    Currently, Environment has the following ReactiveCache setting:
    
    - reactive_cache_refresh_interval = 1.minute (Default Value)
    - reactive_cache_lifetime = 10.minutes (Default Value)
    
    This causes ReactiveCacheWorker to run at least 10 times before the
    lifetime of the `:active` key expires.
    
    When ReactiveCache receives a request for a currently `:active`
    request, the active request is expires time is reset to
    `reactive_cache_lifetime` from the current time - meaning that the
    redis keys will always stay active while they are being requested.
    
    Changing the values to:
    
    - reactive_cache_refresh_interval = 1.minute
    - reactive_cache_lifetime = 55.seconds
    
    will cause the lifetime of the `:active` key to expire sooner than the
    ReactiveCacheWorker runs only if the value key has not been requested
    in the interim. If the user has navigated away from the page, the
    ReactiveCacheWorker will NOT continue to refresh the data for 10
    minutes.  The next execution of the ReactiveCacheWorker will be the
    last one.
    
    I left the refresh interval at 1.minute since our users probably
    expect to get refreshes on 1 minute intervals.
    4692abaa
environment_spec.rb 32.9 KB