2019-12-03 18:36:50 +01:00
|
|
|
class ExportJob < ApplicationJob
|
2020-09-22 17:14:31 +02:00
|
|
|
queue_as :exports
|
|
|
|
|
2021-10-04 12:57:37 +02:00
|
|
|
discard_on ActiveRecord::RecordNotFound
|
|
|
|
|
2023-02-08 17:32:40 +01:00
|
|
|
before_perform do |job|
|
2023-03-08 13:48:44 +01:00
|
|
|
Sentry.set_tags(procedure: job.arguments.first.procedure.id)
|
2023-02-08 17:32:40 +01:00
|
|
|
end
|
|
|
|
|
2023-03-08 18:31:34 +01:00
|
|
|
def max_run_time
|
|
|
|
Export::MAX_DUREE_GENERATION
|
|
|
|
end
|
|
|
|
|
2019-12-03 18:36:50 +01:00
|
|
|
def perform(export)
|
2023-02-08 18:00:43 +01:00
|
|
|
return if export.generated?
|
|
|
|
|
2022-07-07 18:15:48 +02:00
|
|
|
export.compute_with_safe_stale_for_purge do
|
|
|
|
export.compute
|
|
|
|
end
|
2019-12-03 18:36:50 +01:00
|
|
|
end
|
|
|
|
end
|