2021-04-29 17:29:47 +02:00
|
|
|
class ArchiveCreationJob < ApplicationJob
|
2023-09-07 16:53:37 +02:00
|
|
|
discard_on ActiveRecord::RecordNotFound
|
|
|
|
|
2021-11-29 15:43:51 +01:00
|
|
|
queue_as :archives
|
2021-06-24 21:01:59 +02:00
|
|
|
|
2023-03-09 15:37:13 +01:00
|
|
|
def max_run_time
|
|
|
|
Archive::MAX_DUREE_GENERATION
|
|
|
|
end
|
|
|
|
|
2022-06-23 13:51:58 +02:00
|
|
|
def perform(procedure, archive, administrateur_or_instructeur)
|
2022-07-07 18:15:48 +02:00
|
|
|
archive.compute_with_safe_stale_for_purge do
|
|
|
|
ProcedureArchiveService
|
|
|
|
.new(procedure)
|
|
|
|
.make_and_upload_archive(archive)
|
|
|
|
UserMailer.send_archive(administrateur_or_instructeur, procedure, archive).deliver_later
|
|
|
|
end
|
2021-04-29 17:29:47 +02:00
|
|
|
end
|
|
|
|
end
|