mirror of
https://github.com/kikobar/mastodon.git
synced 2024-12-28 00:34:16 +00:00
Fix possible race condition when processing statuses (#10815)
This commit is contained in:
parent
89d600bedb
commit
9a5561a5b8
|
@ -267,7 +267,11 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
def conversation_from_uri(uri)
|
def conversation_from_uri(uri)
|
||||||
return nil if uri.nil?
|
return nil if uri.nil?
|
||||||
return Conversation.find_by(id: OStatus::TagManager.instance.unique_tag_to_local_id(uri, 'Conversation')) if OStatus::TagManager.instance.local_id?(uri)
|
return Conversation.find_by(id: OStatus::TagManager.instance.unique_tag_to_local_id(uri, 'Conversation')) if OStatus::TagManager.instance.local_id?(uri)
|
||||||
Conversation.find_by(uri: uri) || Conversation.create(uri: uri)
|
begin
|
||||||
|
Conversation.find_or_create_by!(uri: uri)
|
||||||
|
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique
|
||||||
|
retry
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def visibility_from_audience
|
def visibility_from_audience
|
||||||
|
|
Loading…
Reference in a new issue