event-horizon
v0.1.7
Published
Stay below a certain number of things per second
Downloads
19
Readme
event-horizon
Eats things that happen too many times per time window. A time window in this case is a sliding window.
Example
Simple
var horizon = require('event-horizon').instance({window: 200, max: 50});
horizon.run(function () {
request(...);
});
With a callback
var horizon = require('event-horizon').instance({window: 200, max: 50});
horizon.run(function () {
request(...);
}, function () {
deferred.reject();
});