diff options
Diffstat (limited to 'lib/gitlab/redis/rate_limiting.rb')
-rw-r--r-- | lib/gitlab/redis/rate_limiting.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/gitlab/redis/rate_limiting.rb b/lib/gitlab/redis/rate_limiting.rb index 4ae1d55e4ce..3a9fb63a495 100644 --- a/lib/gitlab/redis/rate_limiting.rb +++ b/lib/gitlab/redis/rate_limiting.rb @@ -3,13 +3,24 @@ module Gitlab module Redis class RateLimiting < ::Gitlab::Redis::Wrapper - # The data we store on RateLimiting used to be stored on Cache. - def self.config_fallback - Cache - end + class << self + # The data we store on RateLimiting used to be stored on Cache. + def config_fallback + Cache + end + + def cache_store + @cache_store ||= ActiveSupport::Cache::RedisCacheStore.new(redis: pool, namespace: Cache::CACHE_NAMESPACE) + end + + private + + def redis + primary_store = ::Redis.new(::Gitlab::Redis::ClusterRateLimiting.params) + secondary_store = ::Redis.new(params) - def self.cache_store - @cache_store ||= ActiveSupport::Cache::RedisCacheStore.new(redis: pool, namespace: Cache::CACHE_NAMESPACE) + MultiStore.new(primary_store, secondary_store, name.demodulize) + end end end end |