-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Just a bit weird question:
I'm building a module ("network-request"), which places http requests.
I'd like to integrate "function-rate-limit" functionality in it, but I can't understand how to do it...
I did try:
exports.myRequestLimited = rateLimit(1, 3 * 1000, function(url, provider, error, success) {
exports.myRequest(url, provider, error, success);
});
exports.myRequest = function(url, provider, error, success) {
// my logic here...
});
Which works, but I don't like it, since, for example, I can't pass it the limits (1 request every 3 seconds, in this example...).
I'd prefer something like this:
exports.MyRequestLimited = function(url, provider, error, success) {
return rateLimit(1, 3 * 1000, function(url, provider, error, success) {
exports.myRequest(url, provider, error, success);
});
});
But this doesn't work (it freezes...).
Any clues?
Metadata
Metadata
Assignees
Labels
No labels