diff --git a/lib/api.js b/lib/api.js index 7bbd156..9f9fc3e 100644 --- a/lib/api.js +++ b/lib/api.js @@ -30,8 +30,13 @@ async function queue_processor() { await new Promise(resolve => bus.once('send', resolve)); busy = true; } + const before = new Date(); await send_this(queue.dequeue().element); - await sleep(400); // 333 should work, but 400 should still allow some manual requests to go through during development + const duration = new Date() - before; + console.log(before.toISOString(), new Date().toISOString(), duration); + if (duration < 400) { // 333 should work, but 400 should still allow some manual requests to go through during development + await sleep(400 - duration); + } } catch (e) { running = false; throw e;