BigW Consortium Gitlab

clear_worker.rb 451 Bytes
Newer Older
1 2 3
module RepositoryCheck
  class ClearWorker
    include Sidekiq::Worker
Robert Speicher committed
4

5
    sidekiq_options retry: false
Robert Speicher committed
6

7
    def perform
8 9
      # Do small batched updates because these updates will be slow and locking
      Project.select(:id).find_in_batches(batch_size: 100) do |batch|
10 11 12 13 14 15 16
        Project.where(id: batch.map(&:id)).update_all(
          last_repository_check_failed: nil,
          last_repository_check_at: nil,
        )
      end
    end
  end
Robert Speicher committed
17
end