As far as I can understand, the code above will process the requests sequentially, which means that if each request takes 1s to be solved and you have 8 of these requests, the amount of time you’d have to wait is 8s.
Please correct me if I’m wrong!
I just wanted to make sure that I really understand what’s going on. Thanks!
Yes, exactly. They will be in series (sequentially). In some scenarios you'll want to call them in series, and others you'll want them concurrently, just depends on the situation.
It's funny you bring this up - my next post is covering this exact topic (concurrent vs. in series async calls). I'll be posting it early next week, but the short of it is that, if you want the async functions to execute concurrently, use Promise.all
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you for sharing this!
As far as I can understand, the code above will process the requests sequentially, which means that if each request takes 1s to be solved and you have 8 of these requests, the amount of time you’d have to wait is 8s.
Please correct me if I’m wrong!
I just wanted to make sure that I really understand what’s going on. Thanks!
Yes, exactly. They will be in series (sequentially). In some scenarios you'll want to call them in series, and others you'll want them concurrently, just depends on the situation.
It's funny you bring this up - my next post is covering this exact topic (concurrent vs. in series async calls). I'll be posting it early next week, but the short of it is that, if you want the async functions to execute concurrently, use
Promise.all