Look at whether upsert is possible for create/update namespace commit email
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The following discussion from !108236 (merged) should be addressed:
-
@terrichu started a discussion: (+3 comments) suggestion (non-blocking): upsert could be useful to avoid a race condition (edge case), something like this (not sure if this is fully working)
if email_id.nil? remove_namespace_commit_email(existing_namespace_commit_email) else namespace_commit_email = ::Users::NamespaceCommitEmail.new( user: target_user, namespace: namespace, email: email ) namespace_commit_email.validate! ::Users::NamespaceCommitEmail.upsert(namespace_commit_email.attributes, returning: ??, unique_by: ??) end
Edited by 🤖 GitLab Bot 🤖