Optimize RemoveStatusService by removing n+1 query and using shared inboxes (#10247)

main
Eugen Rochko 2019-03-12 22:34:55 +01:00 committed by GitHub
parent 5b50c2cbaa
commit a41afef80c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ class RemoveStatusService < BaseService
@account = status.account @account = status.account
@tags = status.tags.pluck(:name).to_a @tags = status.tags.pluck(:name).to_a
@mentions = status.active_mentions.includes(:account).to_a @mentions = status.active_mentions.includes(:account).to_a
@reblogs = status.reblogs.to_a @reblogs = status.reblogs.includes(:account).to_a
@stream_entry = status.stream_entry @stream_entry = status.stream_entry
@options = options @options = options
@ -77,8 +77,8 @@ class RemoveStatusService < BaseService
end end
# ActivityPub # ActivityPub
ActivityPub::DeliveryWorker.push_bulk(target_accounts.select(&:activitypub?).uniq(&:inbox_url)) do |target_account| ActivityPub::DeliveryWorker.push_bulk(target_accounts.select(&:activitypub?).uniq(&:preferred_inbox_url)) do |target_account|
[signed_activity_json, @account.id, target_account.inbox_url] [signed_activity_json, @account.id, target_account.preferred_inbox_url]
end end
end end