diff --git a/src/Throttler.ts b/src/Throttler.ts index 2996ad0..5235ace 100644 --- a/src/Throttler.ts +++ b/src/Throttler.ts @@ -62,7 +62,7 @@ class Throttle { let timeDiff = currentDate - trigger.lastTrigger; if (timeDiff > this.holdPeriod) { timeDiff -= this.holdPeriod; - trigger.count = Math.floor(Math.min(trigger.count, this.max * (1 - timeDiff / this.resetPeriod))); + trigger.count = Math.floor(Math.min(trigger.count, (this.max + 1) * (1 - timeDiff / this.resetPeriod))); } } @@ -76,7 +76,7 @@ class Throttle { } } - private throw(unjailedIn: number) { + protected throw(unjailedIn: number) { throw new TooManyRequestsHttpError(unjailedIn); } } \ No newline at end of file