move all the cron jobs in a dedicated directory
This commit is contained in:
parent
977736e5d4
commit
513d4f6ff1
23 changed files with 34 additions and 34 deletions
9
app/jobs/cron/purge_unattached_blobs_job.rb
Normal file
9
app/jobs/cron/purge_unattached_blobs_job.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class Cron::PurgeUnattachedBlobsJob < Cron::CronJob
|
||||
self.schedule_expression = "every day at midnight"
|
||||
|
||||
def perform(*args)
|
||||
ActiveStorage::Blob.unattached
|
||||
.where('active_storage_blobs.created_at < ?', 24.hours.ago)
|
||||
.find_each(&:purge_later)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue