Speed up some rake tasks by moving execution to Sidekiq (#7678)
* Speed up some rake tasks by moving execution to Sidekiq mastodon:media:remove_silenced mastodon:media:remove_remote mastodon:media:redownload_avatars mastodon:feeds:build * Fix code style issue
This commit is contained in:
parent
a29f196f95
commit
ad40bf5e0c
4 changed files with 57 additions and 16 deletions
14
app/workers/maintenance/destroy_media_worker.rb
Normal file
14
app/workers/maintenance/destroy_media_worker.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Maintenance::DestroyMediaWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'pull'
|
||||
|
||||
def perform(media_attachment_id)
|
||||
media = MediaAttachment.find(media_attachment_id)
|
||||
media.destroy
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue