Skip to content
Snippets Groups Projects
Commit f7416736 authored by ThibG's avatar ThibG Committed by Eugen Rochko
Browse files

Fixes #3605 by returning account from database in case of race condition (#3606)

parent 0a0b9a27
No related branches found
No related tags found
No related merge requests found
......@@ -61,8 +61,13 @@ class FollowRemoteAccountService < BaseService
account.uri = get_account_uri(xml)
account.hub_url = hubs.first.attribute('href').value
account.save!
get_profile(body, account)
begin
account.save!
get_profile(body, account)
rescue ActiveRecord::RecordNotUnique
# The account has been added by another worker!
return Account.find_remote(confirmed_username, confirmed_domain)
end
account
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment