From d98de8ada743886c3cd48b2ad942d46b805af7a9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 21 Aug 2018 12:25:50 +0200 Subject: Get rid of all batch order warnings (#8334) --- lib/tasks/mastodon.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index f693c8b5a..191ce634c 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -503,7 +503,7 @@ namespace :mastodon do desc 'Remove media attachments attributed to silenced accounts' task remove_silenced: :environment do 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 Maintenance::DestroyMediaWorker.push_bulk(media_attachments.map(&:id)) end @@ -515,7 +515,7 @@ namespace :mastodon do time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago 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 Maintenance::UncacheMediaWorker.push_bulk(media_attachments.map(&:id)) end @@ -535,7 +535,7 @@ namespace :mastodon do accounts = accounts.where(domain: ENV['DOMAIN']) if ENV['DOMAIN'].present? 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 Maintenance::RedownloadAccountMediaWorker.push_bulk(accounts_batch.map(&:id)) end @@ -570,7 +570,7 @@ namespace :mastodon do desc 'Generates home timelines for users who logged in in the past two weeks' 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)) end end -- cgit