diff options
author | Fabio Pitino <fpitino@gitlab.com> | 2019-07-08 13:18:07 +0300 |
---|---|---|
committer | Fabio Pitino <fpitino@gitlab.com> | 2019-07-08 16:50:58 +0300 |
commit | 67de299bb6018bbf460b119404fbab70f3a325c0 (patch) | |
tree | eca957c4c225a52dd17c473f1074ab50bbf5a046 /app/models | |
parent | ededb334c66fa25cb8518258d85b1f7da1dd8f26 (diff) |
Allow ReactiveCaching to support nil value
When :calculate_reactive_caching returns a nil value
this caused ReactiveCaching to schedule a worker
every time the code using :with_reactive_cache was called.
This issue caused an increasing amount of Sidekiq jobs
being created continuously.
Implementing this fix behind feature flag
:reactive_caching_check_key_exists
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/reactive_caching.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/concerns/reactive_caching.rb b/app/models/concerns/reactive_caching.rb index 5b3880f94ba..d91be73d6f0 100644 --- a/app/models/concerns/reactive_caching.rb +++ b/app/models/concerns/reactive_caching.rb @@ -173,7 +173,11 @@ module ReactiveCaching end def within_reactive_cache_lifetime?(*args) - !!Rails.cache.read(alive_reactive_cache_key(*args)) + if Feature.enabled?(:reactive_caching_check_key_exists, default_enabled: true) + Rails.cache.exist?(alive_reactive_cache_key(*args)) + else + !!Rails.cache.read(alive_reactive_cache_key(*args)) + end end def enqueuing_update(*args) |