#2140 Return the existing project trying to add a project which already exists
Closed: MIGRATED 2 years ago by nikromen. Opened 2 years ago by csomh.

(This came up while working with the Python API, but I'm not sure if the solution is going to impact only that one.)

In Packit we hit a race condition, when trying to create the same project from tasks running in parallel. The solution was to check the exception and if it was raised b/c the project already exists, ignore the error. But this is ugly.

Looking at the bigger picture in that code, we also have create_copr_project_if_not_exists(), which first checks if the project already exists, then tries to create it. Which is 2 API calls.

The ask here is to have a new endpoint to project_proxy.add() to not to raise an error, if a project with an identical name and configuration (this is important, if projects are configured differently, the caller should find out about this) already exists, OR

to have a new API which either creates the project if it doesn't exist, or returns the existing project, if it does.


Metadata Update from @praiskup:
- Issue tagged with: API, RFE

2 years ago

Metadata Update from @praiskup:
- Issue tagged with: packit

2 years ago

Metadata Update from @nikromen:
- Issue close_status updated to: MIGRATED
- Issue status updated to: Closed (was: Open)

2 years ago

Log in to comment on this ticket.

Metadata