3 ms·
If your end point does something like: * read from the database * make a request to an API (or really any kind of long running non-database thing) * write to
by mikeocool 2mo ago
If your end point does something like:
* read from the database
* make a request to an API (or really any kind of long running non-database thing)
* write to the database
You're going to end up with a transaction that is open way longer than it needs to be, particularly if you're upstream API is misbehaving, which will potentially end up causing a lot more grief.
- renegade-otter 2mo agoYou can easily deal with these cases by tactically using transactions, but a vast majority of code can be simplified by dealing with an HTTP endpoint as an atomic concept. This all depends on what you are building. A classic CRUD app will benefit from this approach, microservices - not so much,.