Node.js: Sending many AJAX requests to begin backend job queues

721 views Asked by At

Preface: I'm trying to prefetch content from a given set of URLs asynchronously.

I'm needing to send my node.js app around 40-60 local ajax requests in order to add jobs to a queue (node-chain-gang) from the client-side.

Right now, I have it making all the requests at once, and either my node.js app can't handle it or it's just not possible to do so many at once, but it ends up crashing or all the requests do not make it through in proper order. I've tried using a setTimeout in between each request to no avail (in a timely manner).

Is there any other way of queueing these requests/connections asynchronously client-side? Or is there a more efficient way to do this?

1

There are 1 answers

0
Michael Dillon On

Just queuing such a small number of requests should not be a problem for node.js. Either you have come across a bug in node-chain-gang or you have a bug in your code. It would help if you can narrow down the code to a simpler version with the same behavior and post that here.