Merge pull request #4425 from betagouv/dev

2019-10-22-01
This commit is contained in:
Keirua 2019-10-22 15:56:20 +02:00 committed by GitHub
commit 59efe3b815
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,10 @@
class CleanupStaleExportsJob < ApplicationJob
queue_as :cron
def perform(*args)
ActiveStorage::Attachment.where(
"name in ('csv_export_file', 'ods_export_file', 'xlsx_export_file') and created_at < ?",
Procedure::MAX_DUREE_CONSERVATION_EXPORT.ago
).find_each(&:purge_later)
end
end