Fix #16 - Optimize n+1 queries when checking reblogged/favourited values for status lists in API
This commit is contained in:
parent
1de2833f30
commit
de1f3aab86
8 changed files with 23 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue