Re:Code optimizations when using async/await
by petilon on Tuesday January 04, 2022 @12:50PM
(#29797601)
I don't get a warning for this code:
[ Parent
| on HN ]
Re:Code optimizations when using async/await
by fathyb on Tuesday January 04, 2022 @01:44PM
(#29798370)
You should if you await promise1 first:
let result1 = await promise1;
let result2 = await promise2;
Re:Code optimizations when using async/await
by petilon on Tuesday January 04, 2022 @02:09PM
(#29798696)
Yeah, but the goal is to kick off two async calls in parallel. The order in which you await is unimportant for that goal. If awaiting promise2 first solves the problem then that's the solution!
Re:Code optimizations when using async/await
by WolfOliver on Tuesday January 04, 2022 @03:37PM
(#29800089)
so console.log(ex) is never executed?
Re:Code optimizations when using async/await
by WolfOliver on Tuesday January 04, 2022 @03:50PM
(#29800269)
you have to execute it like this:
await foo();
Then you will see the error