Skip to content

Commit bdc3c2e

Browse files
Gargronhiyuki2578
authored andcommitted
Optimize RemoveStatusService by removing n+1 query and using shared inboxes (mastodon#10247)
1 parent e068f0e commit bdc3c2e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/services/remove_status_service.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def call(status, **options)
1010
@account = status.account
1111
@tags = status.tags.pluck(:name).to_a
1212
@mentions = status.active_mentions.includes(:account).to_a
13-
@reblogs = status.reblogs.to_a
13+
@reblogs = status.reblogs.includes(:account).to_a
1414
@stream_entry = status.stream_entry
1515
@options = options
1616

@@ -77,8 +77,8 @@ def remove_from_remote_affected
7777
end
7878

7979
# ActivityPub
80-
ActivityPub::DeliveryWorker.push_bulk(target_accounts.select(&:activitypub?).uniq(&:inbox_url)) do |target_account|
81-
[signed_activity_json, @account.id, target_account.inbox_url]
80+
ActivityPub::DeliveryWorker.push_bulk(target_accounts.select(&:activitypub?).uniq(&:preferred_inbox_url)) do |target_account|
81+
[signed_activity_json, @account.id, target_account.preferred_inbox_url]
8282
end
8383
end
8484

0 commit comments

Comments
 (0)