mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-08 16:54:31 +00:00
Prevent multiple handlers for Delete of Actor from running (#9292)
This commit is contained in:
parent
e8a4ba49cf
commit
c35be6c7e1
|
@ -129,4 +129,10 @@ class ActivityPub::Activity
|
||||||
::FetchRemoteStatusService.new.call(@object['url'])
|
::FetchRemoteStatusService.new.call(@object['url'])
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -12,8 +12,10 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity
|
||||||
private
|
private
|
||||||
|
|
||||||
def delete_person
|
def delete_person
|
||||||
SuspendAccountService.new.call(@account)
|
lock_or_return("delete_in_progress:#{@account.id}") do
|
||||||
@account.destroy!
|
SuspendAccountService.new.call(@account)
|
||||||
|
@account.destroy!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_note
|
def delete_note
|
||||||
|
|
Loading…
Reference in a new issue