Take requests time in consideration for rate limiting calculations
This commit is contained in:
parent
31e14a0a06
commit
e18c5b1fdf
1 changed files with 6 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue