0
0
Fork 0

Add counter caches for a large performance increase on API requests

This commit is contained in:
Eugen Rochko 2017-03-30 15:06:59 +02:00
parent 333e44c3fc
commit de22c202f5
13 changed files with 41 additions and 22 deletions

View file

@ -9,7 +9,7 @@ class Api::V1::FollowRequestsController < ApiController
accounts = Account.where(id: results.map(&:account_id)).map { |a| [a.id, a] }.to_h
@accounts = results.map { |f| accounts[f.account_id] }
set_account_counters_maps(@accounts)
# set_account_counters_maps(@accounts)
next_path = api_v1_follow_requests_url(max_id: results.last.id) if results.size == DEFAULT_ACCOUNTS_LIMIT
prev_path = api_v1_follow_requests_url(since_id: results.first.id) unless results.empty?