闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
283 B

  1. # frozen_string_literal: true
  2. class Scheduler::MediaCleanupScheduler
  3. include Sidekiq::Worker
  4. def perform
  5. unattached_media.find_each(&:destroy)
  6. end
  7. private
  8. def unattached_media
  9. MediaAttachment.reorder(nil).unattached.where('created_at < ?', 1.day.ago)
  10. end
  11. end