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

remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
ThibG 2017-06-08 13:40:11 +02:00 committed by Eugen Rochko
parent 0a0b9a271a
commit f741673638
1 changed files with 7 additions and 2 deletions

View File

@ -61,8 +61,13 @@ class FollowRemoteAccountService < BaseService
account.uri = get_account_uri(xml) account.uri = get_account_uri(xml)
account.hub_url = hubs.first.attribute('href').value account.hub_url = hubs.first.attribute('href').value
begin
account.save! account.save!
get_profile(body, account) 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 account
end end