Node.js: How to throttle a list of requests?
问题 I'm writing a node.js app which needs to get some data from a list of pages from a provider: var list = [ { url: 'http://www.example.com/1' }, { url: 'http://www.example.com/2' }, ... { url: 'http://www.example.com/N' }, ]; Currently I'm using async.each, which works nicely: async.each( list, // 1st param is the array of items function(elem, callback) { // 2nd param is the function that each item is passed to request(elem.url, function (error, response, body) { if (!error && response