2020-03-28 16:49:40 +01:00
|
|
|
class PurgeUnattachedBlobsJob < CronJob
|
|
|
|
self.cron_expression = "0 0 * * *"
|
2019-05-21 11:42:21 +02:00
|
|
|
|
|
|
|
def perform(*args)
|
|
|
|
ActiveStorage::Blob.unattached
|
|
|
|
.where('active_storage_blobs.created_at < ?', 24.hours.ago)
|
|
|
|
.find_each(&:purge_later)
|
|
|
|
end
|
|
|
|
end
|