summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorFabio Pitino <fpitino@gitlab.com>2019-07-08 11:18:07 +0100
committerFabio Pitino <fpitino@gitlab.com>2019-07-08 14:50:58 +0100
commit67de299bb6018bbf460b119404fbab70f3a325c0 (patch)
treeeca957c4c225a52dd17c473f1074ab50bbf5a046 /app/models/concerns
parentededb334c66fa25cb8518258d85b1f7da1dd8f26 (diff)
downloadgitlab-ce-67de299bb6018bbf460b119404fbab70f3a325c0.tar.gz
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/concerns')
-rw-r--r--app/models/concerns/reactive_caching.rb6
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)