Project import data inserts are racy
The following discussion from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2551 should be addressed:
There's a race condition here.
Start with a brand-new project and type
PUTs happen. This exposes a bug in the backend where multiple
ProjectImportDatarecords end up being created, each with their own SSH key. This causes us to switch randomly between keys as there's no ordering applied.
I'll apply a fix to the backend, but we need to do away with the race here too (otherwise you'll start getting error responses).
We need to prevent any more PUTs from being run or queued while the first one is in progress.
The basic issue is that we don't have a unique index on
We also don't have a
NOT NULL requirement.
Both of these things should be fixed, but I'm of the opinion they can go in separately to https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2551