Welcome to mirror list, hosted at ThFree Co, Russian Federation.

clear_worker.rb « repository_check « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5d2db1b44723950d00201663ca51e6ba0598bdc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module RepositoryCheck
  class ClearWorker # rubocop:disable Scalability/IdempotentWorker
    include ApplicationWorker

    data_consistency :always

    sidekiq_options retry: 3
    include RepositoryCheckQueue

    # rubocop: disable CodeReuse/ActiveRecord
    def perform
      # Do small batched updates because these updates will be slow and locking
      Project.select(:id).find_in_batches(batch_size: 100) do |batch|
        Project.where(id: batch.map(&:id)).update_all(
          last_repository_check_failed: nil,
          last_repository_check_at: nil
        )
      end
    end
    # rubocop: enable CodeReuse/ActiveRecord
  end
end