modify export descriptif demarches job

This commit is contained in:
Kara Diaby 2022-07-26 16:33:41 +02:00
parent 058d6baae6
commit a156529394

View file

@ -1,4 +1,5 @@
class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
include DatagouvCronSchedulableConcern
self.schedule_expression = "every month at 3:00"
def perform(*args)
@ -10,13 +11,10 @@ class Cron::Datagouv::ExportAndPublishDemarchesPubliquesJob < Cron::CronJob
begin
DemarchesPubliquesExportService.new(gzip_filepath).call
APIDatagouv::API.upload(gzip_filepath)
io = File.new(gzip_filepath, 'r')
APIDatagouv::API.upload(io, :descriptif_demarches_dataset, :descriptif_demarches_resource)
ensure
FileUtils.rm(gzip_filepath)
end
end
def self.schedulable?
ENV.fetch('OPENDATA_ENABLED', nil) == 'enabled'
end
end