commit
59efe3b815
1 changed files with 10 additions and 0 deletions
10
app/jobs/cleanup_stale_exports_job.rb
Normal file
10
app/jobs/cleanup_stale_exports_job.rb
Normal 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
|
Loading…
Reference in a new issue