diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-02 18:12:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-02 18:12:22 +0300 |
commit | 125c8a6a81c1c09911c09183c66768571cfd95b4 (patch) | |
tree | 638e73410f4180230c882d00d13d11b11bf033da /lib/gitlab/application_rate_limiter.rb | |
parent | d67ccb290ab5e54ff42f9cd464a132fc1d3067e1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/application_rate_limiter.rb')
-rw-r--r-- | lib/gitlab/application_rate_limiter.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/application_rate_limiter.rb b/lib/gitlab/application_rate_limiter.rb index 7c37f67b766..c17c452056a 100644 --- a/lib/gitlab/application_rate_limiter.rb +++ b/lib/gitlab/application_rate_limiter.rb @@ -11,6 +11,8 @@ module Gitlab # redirect_to(edit_project_path(@project), status: :too_many_requests) # end class ApplicationRateLimiter + InvalidKeyError = Class.new(StandardError) + def initialize(key, **options) @key = key @options = options @@ -69,7 +71,7 @@ module Gitlab # # @return [Boolean] Whether or not a request should be throttled def throttled?(key, **options) - return unless rate_limits[key] + raise InvalidKeyError unless rate_limits[key] return if scoped_user_in_allowlist?(options) |