Prevent multiple handlers for Delete of Actor from running (#9292)
這個提交存在於:
父節點
6d4438a6ae
當前提交
ecc58c0f23
共有 2 個檔案被更改,包括 10 行新增 和 2 行删除
|
@ -129,4 +129,10 @@ class ActivityPub::Activity
|
|||
::FetchRemoteStatusService.new.call(@object['url'])
|
||||
end
|
||||
end
|
||||
|
||||
def lock_or_return(key, expire_after = 7.days.seconds)
|
||||
yield if redis.set(key, true, nx: true, ex: expire_after)
|
||||
ensure
|
||||
redis.del(key)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,8 +12,10 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
|
|||
private
|
||||
|
||||
def delete_person
|
||||
SuspendAccountService.new.call(@account)
|
||||
@account.destroy!
|
||||
lock_or_return("delete_in_progress:#{@account.id}") do
|
||||
SuspendAccountService.new.call(@account)
|
||||
@account.destroy!
|
||||
end
|
||||
end
|
||||
|
||||
def delete_note
|
||||
|
|
載入中…
新增表格
新增問題並參考