Add PurgeUnattachedBlobsJob
This commit is contained in:
parent
4a9ef5d12e
commit
f833f57e45
2 changed files with 10 additions and 0 deletions
|
@ -69,6 +69,7 @@ En local, un utilisateur de test est créé automatiquement, avec les identifian
|
|||
Administrateurs::ActivateBeforeExpirationJob.set(cron: "0 8 * * *").perform_later
|
||||
WarnExpiringDossiersJob.set(cron: "0 0 1 * *").perform_later
|
||||
GestionnaireEmailNotificationJob.set(cron: "0 10 * * 1,2,3,4,5,6").perform_later
|
||||
PurgeUnattachedBlobsJob.set("0 0 * * *").perform_later
|
||||
|
||||
### Voir les emails envoyés en local
|
||||
|
||||
|
|
9
app/jobs/purge_unattached_blobs_job.rb
Normal file
9
app/jobs/purge_unattached_blobs_job.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class PurgeUnattachedBlobsJob < ApplicationJob
|
||||
queue_as :cron
|
||||
|
||||
def perform(*args)
|
||||
ActiveStorage::Blob.unattached
|
||||
.where('active_storage_blobs.created_at < ?', 24.hours.ago)
|
||||
.find_each(&:purge_later)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue