about summary refs log tree commit diff
path: root/app/models/follow_suggestion.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-16 18:57:54 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-16 19:10:16 +0200
commitde1f3aab868f8d18198438c405d0852c58f34e10 (patch)
tree914ad2285da94197fccaee7b462f3d7013823707 /app/models/follow_suggestion.rb
parent1de2833f3045d48ab6d696a109a7a71f6a469135 (diff)
Fix #16 - Optimize n+1 queries when checking reblogged/favourited values for status lists in API
Diffstat (limited to 'app/models/follow_suggestion.rb')
-rw-r--r--app/models/follow_suggestion.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/follow_suggestion.rb b/app/models/follow_suggestion.rb
index 25d28f5ac..dbe86a0e4 100644
--- a/app/models/follow_suggestion.rb
+++ b/app/models/follow_suggestion.rb
@@ -22,7 +22,7 @@ END
 
     account_ids  = results['data'].map(&:first)
     blocked_ids  = Block.where(account_id: for_account_id).pluck(:target_account_id)
-    accounts_map = Account.where(id: account_ids - blocked_ids).map { |a| [a.id, a] }.to_h
+    accounts_map = Account.where(id: account_ids - blocked_ids).with_counters.map { |a| [a.id, a] }.to_h
 
     account_ids.map { |id| accounts_map[id] }.compact
   rescue Neography::NeographyError, Excon::Error::Socket => e