1
0
Fork 0

Take requests time in consideration for rate limiting calculations

This commit is contained in:
Julien Dessaux 2023-06-11 23:35:50 +02:00
parent 31e14a0a06
commit e18c5b1fdf
Signed by: adyxax
GPG key ID: F92E51B86E07177E

View file

@ -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;