diff --git a/lib/gitlab/redis/cache.rb b/lib/gitlab/redis/cache.rb index 60944268f91ea24797f547f5eaee3c5fca6af0dd..6121555e43598b0736cd6806a44bc9e22223b9ee 100644 --- a/lib/gitlab/redis/cache.rb +++ b/lib/gitlab/redis/cache.rb @@ -8,9 +8,14 @@ class Cache < ::Gitlab::Redis::Wrapper class << self # Full list of options: # https://api.rubyonrails.org/classes/ActiveSupport/Cache/RedisCacheStore.html#method-c-new + # pool argument event not documented in the link above is handled by RedisCacheStore see: + # https://github.com/rails/rails/blob/593893c901f87b4ed205751f72df41519b4d2da3/activesupport/lib/active_support/cache/redis_cache_store.rb#L165 + # and + # https://github.com/rails/rails/blob/ad790cb2f6bc724a89e4266b505b3c57d5089dae/activesupport/lib/active_support/cache.rb#L206 def active_support_config { redis: pool, + pool: false, compress: Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_REDIS_CACHE_COMPRESSION', '1')), namespace: CACHE_NAMESPACE, expires_in: default_ttl_seconds diff --git a/lib/gitlab/redis/feature_flag.rb b/lib/gitlab/redis/feature_flag.rb index 441ff66903504bc64cf1d13aa13a70c5f3e7abda..395805792d736751ec2e8bbc10f710cc7653826f 100644 --- a/lib/gitlab/redis/feature_flag.rb +++ b/lib/gitlab/redis/feature_flag.rb @@ -14,6 +14,7 @@ def config_fallback def cache_store @cache_store ||= FeatureFlagStore.new( redis: pool, + pool: false, compress: Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_REDIS_CACHE_COMPRESSION', '1')), namespace: Cache::CACHE_NAMESPACE, expires_in: 1.hour diff --git a/lib/gitlab/redis/repository_cache.rb b/lib/gitlab/redis/repository_cache.rb index 966c6584aa55957e451b204444a2b02c6e5b0bec..6d0c35a6829436436cf6a2e23ec49d6944c94a13 100644 --- a/lib/gitlab/redis/repository_cache.rb +++ b/lib/gitlab/redis/repository_cache.rb @@ -15,6 +15,7 @@ def config_fallback def cache_store @cache_store ||= RepositoryCacheStore.new( redis: pool, + pool: false, compress: Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_REDIS_CACHE_COMPRESSION', '1')), namespace: Cache::CACHE_NAMESPACE, expires_in: Cache.default_ttl_seconds diff --git a/spec/lib/gitlab/redis/cache_spec.rb b/spec/lib/gitlab/redis/cache_spec.rb index b7b4ba0eb2f48524a811c608cfd5b687d9df7c00..a48bde5e4ab9630bccad58cb9e7dd374b3822d10 100644 --- a/spec/lib/gitlab/redis/cache_spec.rb +++ b/spec/lib/gitlab/redis/cache_spec.rb @@ -17,5 +17,9 @@ expect(described_class.active_support_config[:expires_in]).to eq(1.day) end + + it 'has a pool set to false' do + expect(described_class.active_support_config[:pool]).to eq(false) + end end end