Created
August 28, 2014 18:00
-
-
Save danypype/fd43628d93967ae22c13 to your computer and use it in GitHub Desktop.
requestThrottler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var requestThrottler = require("request-throttler")({ | |
concurrency: c, | |
executionsPerRound: epr, | |
roundDuration: millis | |
}); | |
//Use case 1 | |
requestThrottler(reqOptions, function (error, response, body){ | |
//... | |
}); | |
//Use case 2 | |
var eventEmitter = requestThrottler(requestOptions); | |
eventEmitter.on("request", function (request) { | |
request.on('response', function (response){ | |
//... | |
}); | |
}); | |
eventEmitter.on("error", function (error) { | |
//... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment