Re:All JavaScript and TypeScript features of the last 3 year...
by hn_throwaway_99 on Thursday March 09, 2023 @10:10PM
(#35089952)
I'm guessing the more common error, which I've definitely hit years ago, is not knowing that Promise.all returns immediately if any of the included promises reject.
Re:All JavaScript and TypeScript features of the last 3 year...
by cagmz on Friday March 10, 2023 @01:04AM
(#35090964)
That's what I'm guessing, too.
Re:All JavaScript and TypeScript features of the last 3 year...
by itslennysfault on Friday March 10, 2023 @11:19AM
(#35096421)
Correct. It was millions of lines of code in a huge code base at a giant enterprise company with 100s of engineers. Somewhere buried in there there was a Promise.all that someone assumed would finish ALL of the promises, and didn't account for the fact that it bails on the first error.
Re:All JavaScript and TypeScript features of the last 3 year...
by itslennysfault on Friday March 10, 2023 @11:27AM
(#35096560)
No, Promise.allSettled didn't exist yet. It was Promise.all.
Someone basically made the assumption that await Promise.all would wait until ALL promises finished. Which is true..... unless one of them throws. In which case it continues. This caused a race condition. It was an extremely complex code base with 100s of engineers and the error very rarely happened, and when it did happen the app would get stuck on a loading screen forever. Also, it turns out "rarely" happens to a lot of people when you have millions of users.
You and your team didn't understand how Promise.allSettled behaved?