2018-11-08 19:23:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
module RepositoryCheck
|
2020-04-08 14:13:33 +05:30
|
|
|
class ClearWorker # rubocop:disable Scalability/IdempotentWorker
|
2018-03-17 18:26:18 +05:30
|
|
|
include ApplicationWorker
|
2016-11-03 12:29:30 +05:30
|
|
|
include RepositoryCheckQueue
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2016-06-02 11:05:42 +05:30
|
|
|
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,
|
2017-09-10 17:25:29 +05:30
|
|
|
last_repository_check_at: nil
|
2016-06-02 11:05:42 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|