diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 18:09:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 18:09:35 +0300 |
commit | 9c6578ed4e0bc92cd838ef96d978df54403e9609 (patch) | |
tree | 5dff7ad20ae6402e4b7a5a44fe4e81ef04855cdf /lib/gitlab/throttle.rb | |
parent | 2af44d609eb8a1579169f9a350bc531d1081d77f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/throttle.rb')
-rw-r--r-- | lib/gitlab/throttle.rb | 14 |
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 |