EVA-4100 Add end-point to generate Submission ID and link to Eload#40
Conversation
| return submissionRepository.save(submission); | ||
| } | ||
|
|
||
| public String getOrGenerateSubmissionIdForEload(Integer eload) { |
There was a problem hiding this comment.
How would two requests that comes at the same time be handled ?
There was a problem hiding this comment.
Each request is handled by a separate thread, and as long as they are for different eloads, there should be no issue.
If 2 requests come at the same time for the same eload, there might be a race condition where both of them might try to generate a new ID and enter it into the database. But we have a unique condition on the database where you can have only one entry for an eload, so one will pass, and the other will fail.
On the client side, we have retries, and the failed request should pass on the retry and retrieve the ID that was inserted for the eload.
We can also put all this in a transaction, which should also take care of the race condition.
| @Operation(summary = "This endpoint retrieves the submission id associated with an eload. " + | ||
| "If there is no submission id for the eload, it will create one, link it to the eload and then retrieve the same") |
There was a problem hiding this comment.
Do we need to have the security = {@SecurityRequirement(name = "basicAuth") like in markSubmissionProcessStepAndStatus ?
There was a problem hiding this comment.
This is just for Swagger documentation so that Swagger shows the textboxes to enter the credentials.
I have added it to all the remaining endpoints under the admin controller to be consistent.
No description provided.