Replace mastodon:media:clear and mastodon:feeds:clear rake tasks with (#3180)
sidekiq-scheduler jobs Resolves #2495
This commit is contained in:
parent
d78f555254
commit
ef900789bc
4 changed files with 53 additions and 4 deletions
17
app/workers/scheduler/media_cleanup_scheduler.rb
Normal file
17
app/workers/scheduler/media_cleanup_scheduler.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
require 'sidekiq-scheduler'
|
||||
|
||||
class Scheduler::MediaCleanupScheduler
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform
|
||||
logger.info 'Cleaning out unattached media attachments'
|
||||
unattached_media.find_each(&:destroy)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def unattached_media
|
||||
MediaAttachment.reorder(nil).where(status_id: nil).where('created_at < ?', 1.day.ago)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue