From 43143fb22e92d65ac5d558e5c72af09699432adf Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 10 Apr 2017 18:38:34 -0400 Subject: [PATCH] Remove order prior to .find_in_batches (#1470) The `Status` class has a default order on it, so when this query gets built and gets all the way to `find_in_batches` there is an order already there. When `find_in_batches` is run it discards any existing order on the query, and emits a warning to the logs if there is one there. This change removes the order prior calling `find_in_batches`, which will stop the logged warning from occurring as well. --- app/lib/feed_manager.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 58d9fb1fc2..339a5c78bd 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -66,7 +66,7 @@ class FeedManager timeline_key = key(:home, into_account.id) oldest_home_score = redis.zrange(timeline_key, 0, 0, with_scores: true)&.first&.last&.to_i || 0 - from_account.statuses.select('id').where('id > ?', oldest_home_score).find_in_batches do |statuses| + from_account.statuses.select('id').where('id > ?', oldest_home_score).reorder(nil).find_in_batches do |statuses| redis.pipelined do statuses.each do |status| redis.zrem(timeline_key, status.id)