Reduce chances of race conditions when processing deleted toots (#9815)

* Reduce chances of race conditions when processing deleted toots

* Prevent race condition when processing deleted toots
This commit is contained in:
ThibG
2019-01-16 15:42:00 +01:00
committed by Eugen Rochko
parent 5363c724fc
commit a4f07bad95
2 changed files with 11 additions and 3 deletions

View File

@ -5,10 +5,12 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
CONVERTED_TYPES = %w(Image Video Article Page).freeze
def perform
return if delete_arrived_first?(object_uri) || unsupported_object_type? || invalid_origin?(@object['id'])
return if unsupported_object_type? || invalid_origin?(@object['id'])
RedisLock.acquire(lock_options) do |lock|
if lock.acquired?
return if delete_arrived_first?(object_uri)
@status = find_existing_status
if @status.nil?