Fix “Scoped order is ignored, it's forced to be batch order.” warnings (#26793)
This commit is contained in:
parent
f80f426c57
commit
cab4cbfa5c
15 changed files with 25 additions and 22 deletions
|
@ -22,7 +22,7 @@ class Admin::StatusBatchAction
|
|||
private
|
||||
|
||||
def statuses
|
||||
Status.with_discarded.where(id: status_ids)
|
||||
Status.with_discarded.where(id: status_ids).reorder(nil)
|
||||
end
|
||||
|
||||
def process_action!
|
||||
|
|
|
@ -20,7 +20,7 @@ module AccountMerging
|
|||
]
|
||||
|
||||
owned_classes.each do |klass|
|
||||
klass.where(account_id: other_account.id).find_each do |record|
|
||||
klass.where(account_id: other_account.id).reorder(nil).find_each do |record|
|
||||
record.update_attribute(:account_id, id)
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
next
|
||||
|
@ -33,7 +33,7 @@ module AccountMerging
|
|||
]
|
||||
|
||||
target_classes.each do |klass|
|
||||
klass.where(target_account_id: other_account.id).find_each do |record|
|
||||
klass.where(target_account_id: other_account.id).reorder(nil).find_each do |record|
|
||||
record.update_attribute(:target_account_id, id)
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
next
|
||||
|
|
|
@ -31,7 +31,7 @@ module AccountStatusesSearch
|
|||
def add_to_public_statuses_index!
|
||||
return unless Chewy.enabled?
|
||||
|
||||
statuses.without_reblogs.where(visibility: :public).find_in_batches do |batch|
|
||||
statuses.without_reblogs.where(visibility: :public).reorder(nil).find_in_batches do |batch|
|
||||
PublicStatusesIndex.import(batch)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -62,13 +62,13 @@ class Trends::Statuses < Trends::Base
|
|||
def refresh(at_time = Time.now.utc)
|
||||
# First, recalculate scores for statuses that were trending previously. We split the queries
|
||||
# to avoid having to load all of the IDs into Ruby just to send them back into Postgres
|
||||
Status.where(id: StatusTrend.select(:status_id)).includes(:status_stat, :account).find_in_batches(batch_size: BATCH_SIZE) do |statuses|
|
||||
Status.where(id: StatusTrend.select(:status_id)).includes(:status_stat, :account).reorder(nil).find_in_batches(batch_size: BATCH_SIZE) do |statuses|
|
||||
calculate_scores(statuses, at_time)
|
||||
end
|
||||
|
||||
# Then, calculate scores for statuses that were used today. There are potentially some
|
||||
# duplicate items here that we might process one more time, but that should be fine
|
||||
Status.where(id: recently_used_ids(at_time)).includes(:status_stat, :account).find_in_batches(batch_size: BATCH_SIZE) do |statuses|
|
||||
Status.where(id: recently_used_ids(at_time)).includes(:status_stat, :account).reorder(nil).find_in_batches(batch_size: BATCH_SIZE) do |statuses|
|
||||
calculate_scores(statuses, at_time)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue