Skip to content

Commit

Permalink
Change domain blocks to immediately mark accounts as suspended
Browse files Browse the repository at this point in the history
Rather than doing so sequentially, account after account, while cleaning
their data. This doesn't change much about the time the block takes to
complete, but it immediately prevents interaction with the blocked domain,
while up to now, it would only be guaranteed when the process ends.
  • Loading branch information
ClearlyClaire committed Jun 3, 2020
1 parent 9abbf31 commit 00c7d28
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/services/block_domain_service.rb
Expand Up @@ -34,7 +34,8 @@ def silence_accounts!
end

def suspend_accounts!
blocked_domain_accounts.without_suspended.reorder(nil).find_each do |account|
blocked_domain_accounts.without_suspended.in_batches.update_all(suspended_at: @domain_block.created_at)
blocked_domain_accounts.where(suspended_at: @domain_block.created_at).reorder(nil).find_each do |account|
SuspendAccountService.new.call(account, reserve_username: true, suspended_at: @domain_block.created_at)
end
end
Expand Down

0 comments on commit 00c7d28

Please sign in to comment.