Fix N+1 on mentions in PushUpdateWorker (#19637)

This commit is contained in:
Claire 2022-11-01 16:03:51 +01:00 committed by GitHub
parent 15bae3e0e4
commit 6804228fdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ class PushUpdateWorker
def perform(account_id, status_id, timeline_id = nil, options = {}) def perform(account_id, status_id, timeline_id = nil, options = {})
@account = Account.find(account_id) @account = Account.find(account_id)
@status = Status.find(status_id) @status = Status.includes(active_mentions: :account, reblog: { active_mentions: :account }).find(status_id)
@timeline_id = timeline_id || "timeline:#{account.id}" @timeline_id = timeline_id || "timeline:#{account.id}"
@options = options.symbolize_keys @options = options.symbolize_keys