fix(SimpleIdentifyThrottler): don't sleep negative amounts

This commit is contained in:
didinele
2024-12-30 20:49:21 +02:00
committed by Vlad Frangu
parent fdf0b8455c
commit a589c6d492
2 changed files with 37 additions and 12 deletions

View File

@@ -36,7 +36,7 @@ export class SimpleIdentifyThrottler implements IIdentifyThrottler {
try {
const diff = state.resetsAt - Date.now();
if (diff <= 5_000) {
if (diff > 0 && diff <= 5_000) {
// To account for the latency the IDENTIFY payload goes through, we add a bit more wait time
const time = diff + Math.random() * 1_500;
await sleep(time);