Skip to content

Commit

Permalink
Move sending account Delete to anyone but the account's followers to …
Browse files Browse the repository at this point in the history
…the pull̀ queue (#10016)
  • Loading branch information
ClearlyClaire authored and Gargron committed Feb 17, 2019
1 parent 41ecf80 commit d662675
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/services/suspend_account_service.rb
Expand Up @@ -102,6 +102,10 @@ def distribute_delete_actor!
ActivityPub::DeliveryWorker.push_bulk(delivery_inboxes) do |inbox_url|
[delete_actor_json, @account.id, inbox_url]
end

ActivityPub::LowPriorityDeliveryWorker.push_bulk(low_priority_delivery_inboxes) do |inbox_url|
[delete_actor_json, @account.id, inbox_url]
end
end

def delete_actor_json
Expand All @@ -117,7 +121,11 @@ def delete_actor_json
end

def delivery_inboxes
Account.inboxes + Relay.enabled.pluck(:inbox_url)
@delivery_inboxes ||= @account.followers.inboxes + Relay.enabled.pluck(:inbox_url)
end

def low_priority_delivery_inboxes
Account.inboxes - delivery_inboxes
end

def associations_for_destruction
Expand Down
5 changes: 5 additions & 0 deletions app/workers/activitypub/low_priority_delivery_worker.rb
@@ -0,0 +1,5 @@
# frozen_string_literal: true

class ActivityPub::LowPriorityDeliveryWorker < ActivityPub::DeliveryWorker
sidekiq_options queue: 'pull', retry: 8, dead: false
end

0 comments on commit d662675

Please sign in to comment.