|
|
@ -503,7 +503,7 @@ namespace :mastodon do
|
|
|
|
desc 'Remove media attachments attributed to silenced accounts'
|
|
|
|
desc 'Remove media attachments attributed to silenced accounts'
|
|
|
|
task remove_silenced: :environment do
|
|
|
|
task remove_silenced: :environment do
|
|
|
|
nb_media_attachments = 0
|
|
|
|
nb_media_attachments = 0
|
|
|
|
MediaAttachment.where(account: Account.silenced).select(:id).find_in_batches do |media_attachments|
|
|
|
|
MediaAttachment.where(account: Account.silenced).select(:id).reorder(nil).find_in_batches do |media_attachments|
|
|
|
|
nb_media_attachments += media_attachments.length
|
|
|
|
nb_media_attachments += media_attachments.length
|
|
|
|
Maintenance::DestroyMediaWorker.push_bulk(media_attachments.map(&:id))
|
|
|
|
Maintenance::DestroyMediaWorker.push_bulk(media_attachments.map(&:id))
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -515,7 +515,7 @@ namespace :mastodon do
|
|
|
|
time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago
|
|
|
|
time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago
|
|
|
|
nb_media_attachments = 0
|
|
|
|
nb_media_attachments = 0
|
|
|
|
|
|
|
|
|
|
|
|
MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).select(:id).find_in_batches do |media_attachments|
|
|
|
|
MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).select(:id).reorder(nil).find_in_batches do |media_attachments|
|
|
|
|
nb_media_attachments += media_attachments.length
|
|
|
|
nb_media_attachments += media_attachments.length
|
|
|
|
Maintenance::UncacheMediaWorker.push_bulk(media_attachments.map(&:id))
|
|
|
|
Maintenance::UncacheMediaWorker.push_bulk(media_attachments.map(&:id))
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -535,7 +535,7 @@ namespace :mastodon do
|
|
|
|
accounts = accounts.where(domain: ENV['DOMAIN']) if ENV['DOMAIN'].present?
|
|
|
|
accounts = accounts.where(domain: ENV['DOMAIN']) if ENV['DOMAIN'].present?
|
|
|
|
nb_accounts = 0
|
|
|
|
nb_accounts = 0
|
|
|
|
|
|
|
|
|
|
|
|
accounts.select(:id).find_in_batches do |accounts_batch|
|
|
|
|
accounts.select(:id).reorder(nil).find_in_batches do |accounts_batch|
|
|
|
|
nb_accounts += accounts_batch.length
|
|
|
|
nb_accounts += accounts_batch.length
|
|
|
|
Maintenance::RedownloadAccountMediaWorker.push_bulk(accounts_batch.map(&:id))
|
|
|
|
Maintenance::RedownloadAccountMediaWorker.push_bulk(accounts_batch.map(&:id))
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -570,7 +570,7 @@ namespace :mastodon do
|
|
|
|
|
|
|
|
|
|
|
|
desc 'Generates home timelines for users who logged in in the past two weeks'
|
|
|
|
desc 'Generates home timelines for users who logged in in the past two weeks'
|
|
|
|
task build: :environment do
|
|
|
|
task build: :environment do
|
|
|
|
User.active.select(:id, :account_id).find_in_batches do |users|
|
|
|
|
User.active.select(:id, :account_id).reorder(nil).find_in_batches do |users|
|
|
|
|
RegenerationWorker.push_bulk(users.map(&:account_id))
|
|
|
|
RegenerationWorker.push_bulk(users.map(&:account_id))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|