debian-mirror-gitlab/lib/gitlab/repository_archive_rate_limiter.rb

14 lines
410 B
Ruby
Raw Normal View History

2022-01-26 12:08:38 +05:30
# frozen_string_literal: true
module Gitlab
module RepositoryArchiveRateLimiter
def check_archive_rate_limit!(current_user, project, &block)
2022-03-02 08:16:31 +05:30
return unless Feature.enabled?(:archive_rate_limit, default_enabled: :yaml)
2022-01-26 12:08:38 +05:30
threshold = current_user ? nil : 100
check_rate_limit!(:project_repositories_archive, scope: [project, current_user], threshold: threshold, &block)
end
end
end