summaryrefslogtreecommitdiff
path: root/lib/gitlab/repository_archive_rate_limiter.rb
blob: d395b1aba7f1bd32bbce0f781cec41bb32ad7bec (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, default_enabled: :yaml)

      threshold = current_user ? nil : 100

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