throvents
v0.0.1
Published
THROttle eVENTS offer a higher level interface to rate limiting
Downloads
2
Maintainers
Readme
High level interface for request throttling via events.
Usage
const {limiter, jobs} = require('throvents');
// job may only occur once every 30 minutes (Time specified in seconds).
const L = limiter(60*30, 'fetch');
jobs.on('fetchTweets', ({id, as}) => {
request({id, as}).then(...)
});
// Fires immediately
L({ id: 'A5CF12', as: 'csv' });
// Will fire in 30 minutes.
L({ id: 'B66E4D', as: 'json' });