LinuxForHealth / FHIR

The LinuxForHealth FHIR® Server and related projects
https://linuxforhealth.github.io/FHIR
Apache License 2.0
330 stars 157 forks source link

Add 'Retry-After' header in case of db locking / deadlock-related failures #3930

Open lmsurpre opened 2 years ago

lmsurpre commented 2 years ago

Is your feature request related to a problem? Please describe. Its possible to get deadlock issues (especially during parallel batch/bundle processing). Currently that results in a 500 error and clients should retry.

Describe the solution you'd like Consider adding something more explicit about whether/when the client should retry. For example, if we can return 503 instead of 500, we could include a Retry-After header in the response.

Describe alternatives you've considered

Acceptance Criteria

  1. GIVEN [a precondition] AND [another precondition] WHEN [test step] AND [test step] THEN [verification step] AND [verification step]

Additional context Maybe update our client to automatically retry in this case as well?

lmsurpre commented 2 years ago

Probably send some random time (random backoff) with configurability (min/max/average?)