DEV Community

Discussion on: The dangers of async/await

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

well the trade-off here is that by using parallelism, you will probably spend more time coding and debugging your code.
I think it's fine to do the simple thing by default and parallelize only when you have measured that it's worth it

Collapse
 
christopherkade profile image
Christopher Kade

Agreed, to some extent. If you have a clear way of determining which query failed and why, it shouldn't be taking you more time to debug whenever one of them throws an error.

As you said, it must be a calculated risk.

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

It depends, if you have two http queries that are totally independant OK, but if you have a number of asynchronous calls that do side effects, it's much harder to reason about it if you add parallelism

Thread Thread
 
christopherkade profile image
Christopher Kade

That's a good point yeah, it can make it much harder to determine the cause of everything falling apart. It really should be done in the right circumstances.

Thread Thread
 
mx profile image
Maxime Moreau

Async with side effects is my nightmare :(