Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/redis/rate_limiting.rb')
-rw-r--r--lib/gitlab/redis/rate_limiting.rb27
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/gitlab/redis/rate_limiting.rb b/lib/gitlab/redis/rate_limiting.rb
index 4ae1d55e4ce..12710bafbea 100644
--- a/lib/gitlab/redis/rate_limiting.rb
+++ b/lib/gitlab/redis/rate_limiting.rb
@@ -3,13 +3,28 @@
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,
+ error_handler: ::Gitlab::Redis::ERROR_HANDLER
+ )
+ 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