patchew-project / patchew

A patch email tracking and testing system
MIT License
73 stars 24 forks source link

Unique Constraint Error while Importing #83

Closed shubhamdotjain closed 2 years ago

shubhamdotjain commented 6 years ago

On importing a message which is already imported before, the REST would give error UNIQUE constraint failed: api_message.project_id, api_message.message_id. This breaks scripts/patchew-impoter. Upon network error, the importer instance is restarted and will retry the import. The server may already received the message but just failed to return to patchew-cli, in this case, an empty project_list makes more sense than error.

bonzini commented 6 years ago

Summarizing what Fam said on the mailing list, if the message already exists, the /api/v1/messages endpoint must report the existing URI, as long as the user has permissions to import it. For /api/v1/projects/NN/messages it should fail instead.

bonzini commented 2 years ago

Fixed in commit 77150db46bb308bab579349792099463d5a0fbf0.