-
Stan Hu authored
If multiple projects within a group are created concurrently, a validation error due to duplicate ProjectAuthorization entries could be triggered. This can happen due to a race condition: if the user's or group's authorizations get refreshed before the `Projects::CreateService` does this, we can get a database unique key violation. To fix this, we use `safe_find_or_create_by!` to ensure that a duplicate entry doesn't get inserted. This fixes a regression introduced in GitLab 13.4 via https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42335. Closes https://gitlab.com/gitlab-org/gitlab/-/issues/233862
f1543604