Fix possible race conditions when suspending/unsuspending accounts (#22363)
* Fix possible race conditions when suspending/unsuspending accounts * Fix tests Tests were assuming SuspensionWorker and UnsuspensionWorker would do the suspending/unsuspending themselves, but this has changed.
This commit is contained in:
parent
8683a082dd
commit
18fb01ef7c
4 changed files with 18 additions and 19 deletions
|
@ -2,10 +2,12 @@
|
|||
|
||||
class UnsuspendAccountService < BaseService
|
||||
include Payloadable
|
||||
|
||||
# Restores a recently-unsuspended account
|
||||
# @param [Account] account Account to restore
|
||||
def call(account)
|
||||
@account = account
|
||||
|
||||
unsuspend!
|
||||
refresh_remote_account!
|
||||
|
||||
return if @account.nil? || @account.suspended?
|
||||
|
@ -18,10 +20,6 @@ class UnsuspendAccountService < BaseService
|
|||
|
||||
private
|
||||
|
||||
def unsuspend!
|
||||
@account.unsuspend! if @account.suspended?
|
||||
end
|
||||
|
||||
def refresh_remote_account!
|
||||
return if @account.local?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue