DEV Community

Discussion on: Don't Make This Async/Await Oopsie!

lmorchard profile image
Les Orchard

Calling this an oopsie or an error is a bit unfortunate.

Sometimes you want to make requests serially. This is not a mistake.

Maybe you want to fail or interrupt the whole process based on the result of one of the fetches. You can do that easily in a for loop.

Consider if you had 100 fetches to do - you don't want to fire them all off simultaneously and flood the services you're using. You could take serial chunks of the work in a for loop and fire those off in parallel.

So, good tip with map & Promise.all, but serial execution is not a mistake in and of itself

mebble profile image
Neil Syiemlieh Author

Thank you for this comment. I should have stated that this is only something people should be aware of. I went with a clickbaity title just to get it out there. I'll update the article to include this.