DEV Community

Discussion on: Handling a lot of requests in JavaScript with promises

Collapse
 
ajz profile image
ajizanzi

Great article. I have a recursive function that makes the requests (it crawls a website), so I cannot know before hand all the requests to be made. How do I go about it?

Collapse
 
karataev profile image
Eugene Karataev

I'd go the easiest path at first - made requests recursively one by one. If performance is not ok then try to make requests concurrent where possible.

Collapse
 
ajz profile image
ajizanzi

I'm making the requests one by one, but I still get the connection reset and timeout errors.

Thread Thread
 
karataev profile image
Eugene Karataev

Well, timeout error may occur in natural way considering that your app crawls websites. You need to catch such errors and handle them appropriately.

I wrote this post because this research helped me to solve problems in my day to day job. This post doesn't have answers for all questions. It can be used as a reference when applied to your specific situation.