about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-30 15:14:07 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-10-30 15:14:07 +0100
commitfa1cc2d05a12783e166f30bf7a0b3239ebccf732 (patch)
treee140b30a884f20b8efe0e45d713695b62ab07f6e /app/models
parentf10feb2e701ec2c07252be4dcc3bec44973650f9 (diff)
Limit returned followees/followers by API to 40 for now
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 49af7962c..8542852bc 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -125,7 +125,7 @@ class Account < ApplicationRecord
   def common_followers_with(other_account)
     results  = Neography::Rest.new.execute_query('MATCH (a {account_id: {a_id}})-[:follows]->(b)-[:follows]->(c {account_id: {c_id}}) RETURN b.account_id', a_id: id, c_id: other_account.id)
     ids      = results['data'].map(&:first)
-    accounts = Account.where(id: ids).with_counters.map { |a| [a.id, a] }.to_h
+    accounts = Account.where(id: ids).with_counters.limit(20).map { |a| [a.id, a] }.to_h
     ids.map { |id| accounts[id] }.compact
   rescue Neography::NeographyError, Excon::Error::Socket
     []