2016-04-13 13:56:05 +00:00
|
|
|
module RepositoryCheck
|
|
|
|
class ClearWorker
|
|
|
|
include Sidekiq::Worker
|
2016-04-14 16:28:48 +00:00
|
|
|
|
2016-04-13 13:56:05 +00:00
|
|
|
sidekiq_options retry: false
|
2016-04-14 16:28:48 +00:00
|
|
|
|
2016-04-13 13:56:05 +00:00
|
|
|
def perform
|
2016-04-13 15:33:25 +00:00
|
|
|
# Do small batched updates because these updates will be slow and locking
|
|
|
|
Project.select(:id).find_in_batches(batch_size: 100) do |batch|
|
2016-04-13 13:56:05 +00:00
|
|
|
Project.where(id: batch.map(&:id)).update_all(
|
|
|
|
last_repository_check_failed: nil,
|
|
|
|
last_repository_check_at: nil,
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-04-14 16:28:48 +00:00
|
|
|
end
|