2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-04-21 11:40:23 +02:00
|
|
|
class Cron::StalledDeclarativeProceduresJob < Cron::CronJob
|
2023-06-13 16:23:40 +02:00
|
|
|
self.schedule_expression = "every 10 minutes"
|
2023-04-21 11:40:23 +02:00
|
|
|
|
2023-06-13 16:23:40 +02:00
|
|
|
def perform
|
2023-04-21 11:40:23 +02:00
|
|
|
Procedure.declarative.find_each do |procedure|
|
2023-06-13 16:23:40 +02:00
|
|
|
procedure.dossiers.state_en_construction.where(declarative_triggered_at: nil).find_each do |dossier|
|
|
|
|
ProcessStalledDeclarativeDossierJob.perform_later(dossier)
|
2023-04-21 11:40:23 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|