about summary refs log tree commit diff
path: root/lib/tasks/mastodon.rake
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-21 19:54:21 +0200
committerGitHub <noreply@github.com>2018-08-21 19:54:21 +0200
commit37965ac8d9773ae79f6b8dd6fcd353894d2194ca (patch)
tree51f194442d2ec7ab760b443b98c7685f64481ca7 /lib/tasks/mastodon.rake
parentc78918162642649ce294d89effbf2e815c2aa327 (diff)
parent8b4abaa90d8dff64525d92c3ba1c750356608240 (diff)
Merge pull request #660 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'lib/tasks/mastodon.rake')
-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