I'd like to use a pattern like the following:
const limit = require('simple-rate-limiter');
var f = limit(proccessWork).to(1).per(100);
function batchWork(n) {
q = getNextWorkBatch(n);
for (var idx in q) { processWork(q[idx]); }
}
batchWork(100);
f.on('finish', function() { batchWork(100) });
Any suggestions?
(Maybe an on 'begin' event if the queue was empty and the function got called?)