From 030a7ee62740e5f7def3a7333d1c8996b3111fef Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Mon, 25 Sep 2023 10:43:32 -0400 Subject: [PATCH] 20300: Bypass query cache when re-fetching record for race check. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- services/api/app/models/api_client_authorization.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/api/app/models/api_client_authorization.rb b/services/api/app/models/api_client_authorization.rb index 756d835eff..ef73d79c17 100644 --- a/services/api/app/models/api_client_authorization.rb +++ b/services/api/app/models/api_client_authorization.rb @@ -389,7 +389,9 @@ class ApiClientAuthorization < ArvadosModel rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique Rails.logger.debug("remote user #{remote_user['uuid']} already exists, retrying...") # Some other request won the race: retry fetching the user record. - user = User.find_by_uuid(remote_user['uuid']) + user = User.uncached do + User.find_by_uuid(remote_user['uuid']) + end if !user Rails.logger.warn("cannot find or create remote user #{remote_user['uuid']}") return nil -- 2.30.2