From 1d0ad558ff51ce3e42ef4e4c9a9bed3c4b722d0d Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 15 Mar 2023 03:45:15 +0100 Subject: Change sidekiq-bulk's batch size from 10,000 to 1,000 jobs in one Redis call (#24034) --- app/services/suspend_account_service.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app/services/suspend_account_service.rb') diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index 211544fea..cfb3eb583 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -31,13 +31,13 @@ class SuspendAccountService < BaseService # counterpart to this operation, i.e. you can't then force a remote # account to re-follow you, so this part is not reversible. - follows = Follow.where(account: @account).to_a + Follow.where(account: @account).find_in_batches do |follows| + ActivityPub::DeliveryWorker.push_bulk(follows) do |follow| + [Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), follow.target_account_id, @account.inbox_url] + end - ActivityPub::DeliveryWorker.push_bulk(follows) do |follow| - [Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), follow.target_account_id, @account.inbox_url] + follows.each(&:destroy) end - - follows.each(&:destroy) end def distribute_update_actor! @@ -45,7 +45,7 @@ class SuspendAccountService < BaseService account_reach_finder = AccountReachFinder.new(@account) - ActivityPub::DeliveryWorker.push_bulk(account_reach_finder.inboxes) do |inbox_url| + ActivityPub::DeliveryWorker.push_bulk(account_reach_finder.inboxes, limit: 1_000) do |inbox_url| [signed_activity_json, @account.id, inbox_url] end end -- cgit