How to queue http get requests in Nodejs in order to control their rate?
I have a NodeJS app which sends HTTP get requests from various places in the code, some are even dependent (sending a request, waiting for a reply, processing it and based on results sending another request). I need to limit the rate the requests (e.g., 10 requests per hour).
I thought about queuing the requests and then at some central point releasing them in a controlled manner, but got stuck at how to queue the callback functions and their dependent parameters.
Would be happy to hear suggestions how to over come this scenario with minimum restructuring for the app.