mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-23 02:51:13 +01:00
Add account_id DESC
to optimize PrecomputeFeedService (#2967)
This commit is contained in:
parent
57a3d71c90
commit
c3ef5d5414
1 changed files with 2 additions and 1 deletions
|
@ -6,7 +6,8 @@ class PrecomputeFeedService < BaseService
|
|||
# @param [Account] account
|
||||
def call(_, account)
|
||||
redis.pipelined do
|
||||
Status.as_home_timeline(account).limit(FeedManager::MAX_ITEMS / 4).each do |status|
|
||||
# NOTE: Added `id desc, account_id desc` to `ORDER BY` section to optimize query.
|
||||
Status.as_home_timeline(account).order(account_id: :desc).limit(FeedManager::MAX_ITEMS / 4).each do |status|
|
||||
next if status.direct_visibility? || FeedManager.instance.filter?(:home, status, account.id)
|
||||
redis.zadd(FeedManager.instance.key(:home, account.id), status.id, status.reblog? ? status.reblog_of_id : status.id)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue