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>2021-04-21 18:09:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 18:09:35 +0300
commit9c6578ed4e0bc92cd838ef96d978df54403e9609 (patch)
tree5dff7ad20ae6402e4b7a5a44fe4e81ef04855cdf /lib/gitlab/throttle.rb
parent2af44d609eb8a1579169f9a350bc531d1081d77f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/throttle.rb')
-rw-r--r--lib/gitlab/throttle.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlab/throttle.rb b/lib/gitlab/throttle.rb
index 520075012e8..8f045021088 100644
--- a/lib/gitlab/throttle.rb
+++ b/lib/gitlab/throttle.rb
@@ -49,6 +49,20 @@ module Gitlab
{ limit: limit_proc, period: period_proc }
end
+ def self.unauthenticated_packages_api_options
+ limit_proc = proc { |req| settings.throttle_unauthenticated_packages_api_requests_per_period }
+ period_proc = proc { |req| settings.throttle_unauthenticated_packages_api_period_in_seconds.seconds }
+
+ { limit: limit_proc, period: period_proc }
+ end
+
+ def self.authenticated_packages_api_options
+ limit_proc = proc { |req| settings.throttle_authenticated_packages_api_requests_per_period }
+ period_proc = proc { |req| settings.throttle_authenticated_packages_api_period_in_seconds.seconds }
+
+ { limit: limit_proc, period: period_proc }
+ end
+
def self.rate_limiting_response_text
(settings.rate_limiting_response_text.presence || DEFAULT_RATE_LIMITING_RESPONSE_TEXT) + "\n"
end