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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-03 00:12:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-03 00:12:31 +0300
commita88ffaad9f9f321a71657ac0aca4d947f5bc6a5b (patch)
treec4baeb79c24082ea806b8ce4f27fcc94903b742e /lib/gitlab/rack_attack
parent3c4d101de003ea292be5ac5baf5d73c6c2747367 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/rack_attack')
-rw-r--r--lib/gitlab/rack_attack/instrumented_cache_store.rb33
1 files changed, 0 insertions, 33 deletions
diff --git a/lib/gitlab/rack_attack/instrumented_cache_store.rb b/lib/gitlab/rack_attack/instrumented_cache_store.rb
deleted file mode 100644
index d8beb259fba..00000000000
--- a/lib/gitlab/rack_attack/instrumented_cache_store.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module RackAttack
- # This class is a proxy for all Redis calls made by RackAttack. All
- # the calls are instrumented, then redirected to the underlying
- # store (in `.store). This class instruments the standard interfaces
- # of ActiveRecord::Cache defined in
- # https://github.com/rails/rails/blob/v6.0.3.1/activesupport/lib/active_support/cache.rb#L315
- #
- # For more information, please see
- # https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/751
- class InstrumentedCacheStore
- NOTIFICATION_CHANNEL = 'redis.rack_attack'
-
- delegate :silence!, :mute, to: :@upstream_store
-
- def initialize(upstream_store: ::Gitlab::Redis::RateLimiting.cache_store, notifier: ActiveSupport::Notifications)
- @upstream_store = upstream_store
- @notifier = notifier
- end
-
- [:fetch, :read, :read_multi, :write_multi, :fetch_multi, :write, :delete,
- :exist?, :delete_matched, :increment, :decrement, :cleanup, :clear].each do |interface|
- define_method interface do |*args, **k_args, &block|
- @notifier.instrument(NOTIFICATION_CHANNEL, operation: interface) do
- @upstream_store.public_send(interface, *args, **k_args, &block) # rubocop:disable GitlabSecurity/PublicSend
- end
- end
- end
- end
- end
-end