409 when saving device images
Under certain conditions I can reproduce a bug when managing device images.
Workflow:
- add a device
- add two attachments that can be used as images
- edit the device to show both images
- edit the device again:
- remove the first image
- re-add it to the list
- set it to the first position
When I then click on save, I get an error from the database:
{
"errors": [
{
"source": "There is already an image entry for the attachment for this device.",
"status": 409,
"title": "Conflict"
}
],
"jsonapi": {
"version": "1.0"
}
}
It ordering of the requests seem to be fine. The deletion happens before the post, so the error here should not happen.
In fact it doen't happen when running the sms locally, but on GFZ staging (& likely also on GFZ prod). Could it be related to different states between the worker threads?