3 ms·
If the database is unresponsive, I would prefer to return 5xx to the caller as soon as possible. May be this service is not so important and it's better to pres
by vbezhenar 4y ago
If the database is unresponsive, I would prefer to return 5xx to the caller as soon as possible. May be this service is not so important and it's better to present to user an incomplete page rather than waiting for hours or days until database is available.
If it is important, caller will call the service until he got response.
Again: fail fast. Even in distributed systems. Unless you're 100% sure that you know better how to handle this particular issue.
- eweise 4y agoTotally agree about returning a 5XX error. In my app that would be a single RetryableException back to the caller instead of the internal db error.
- hbrn 4y agoUgh. You should never call something "RetryableException". 1. You are in no position to decide for your customer whether exception is "Retryable". 2. For cases where you are in that position, you should just retry automatically. 3. RetryableException tells absolutely nothing about what happened. It's no better than raising MondayException for exceptions that happen on Monday.