refactor: add dol_move_batch job which are enqueued by the cron
This commit is contained in:
parent
676112dd6f
commit
34fae2831f
3 changed files with 16 additions and 1 deletions
|
@ -4,6 +4,8 @@ class Cron::DossierOperationLogMoveToColdStorageJob < Cron::CronJob
|
|||
def perform
|
||||
DossierOperationLog
|
||||
.with_data
|
||||
.find_each(&:move_to_cold_storage!)
|
||||
.in_batches do |batch|
|
||||
DossierOperationLogMoveToColdStorageBatchJob.perform_later(batch.ids)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class DossierOperationLogMoveToColdStorageBatchJob < ApplicationJob
|
||||
queue_as :low_priority
|
||||
|
||||
def perform(ids)
|
||||
DossierOperationLog.where(id: ids)
|
||||
.with_data
|
||||
.find_each(&:move_to_cold_storage!)
|
||||
end
|
||||
end
|
|
@ -59,5 +59,9 @@ if Rails.env.production? && SIDEKIQ_ENABLED
|
|||
class APIEntreprise::Job < ApplicationJob
|
||||
self.queue_adapter = :sidekiq
|
||||
end
|
||||
|
||||
class DossierOperationLogMoveToColdStorageBatchJob < ApplicationJob
|
||||
self.queue_adapter = :sidekiq
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue