summaryrefslogtreecommitdiff
path: root/lib/gitlab/repository_archive_rate_limiter.rb
blob: 31a3dc34bf6c9babf26195b7bc0f0c67dae2c23d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

module Gitlab
  module RepositoryArchiveRateLimiter
    def check_archive_rate_limit!(current_user, project, &block)
      return unless Feature.enabled?(:archive_rate_limit)

      threshold = current_user ? nil : 100

      check_rate_limit!(:project_repositories_archive, scope: [project, current_user], threshold: threshold, &block)
    end
  end
end