3 ms·
I have to agree... just because someone may have a case where they need multi-stage transactions or cancellable workers doesn't mean that Promises and async/awa
by tracker1 11y ago
I have to agree... just because someone may have a case where they need multi-stage transactions or cancellable workers doesn't mean that Promises and async/await aren't useful as they stand.
I wrote a ton of code last year to migrate data from one system to another... without async/await, Promises and node-style streams, it would have been really nasty, deeply nested code... as it was, the flows were fairly functional, really elegant, and worked extremely well. I will say that Bluebird is useful beyond what the Promises spec offers, and have gone back and forth between using it, replacing the native Promise where available and just using whatever promise shim or native is available.
I didn't like promises earlier on, as without some of the extras that async functions offer, I didn't consider them much better than callbacks. Now, I'm sold.
- spion 11y agoNot sure what you mean by multi-stage transactions? It applies for ordinary transactions - its just a way to avoid passing a transaction parameter everywhere but still guaranteeing that the entire batch of queries executed within a single transaction. I don't think the problems I'm describing here are all that uncommon in server-side code. Continuation local storage (the equivalent of thread local storage) in particular seems to be an often requested feature by many users in node.