about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-08-21 12:25:50 +0200
committerGitHub <noreply@github.com>2018-08-21 12:25:50 +0200
commitd98de8ada743886c3cd48b2ad942d46b805af7a9 (patch)
tree9c7551f7b60a7884929e259e85d91f14c6602395 /lib
parent83746b63646088396232a348f4024b101f39c78a (diff)
Get rid of all batch order warnings (#8334)
Diffstat (limited to 'lib')
-rw-r--r--lib/tasks/mastodon.rake8
1 files changed, 4 insertions, 4 deletions
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