diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-12-09 13:46:28 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-12-09 13:46:28 +0100 |
commit | 99bccae9fe1588f711e7606dc3c6d7dd4a25675a (patch) | |
tree | 003402658b476b71ed0b0d34c020f80c1c63493d /src/util | |
parent | 3f71aff19f3d7223167c36fe0cf661571501eed0 (diff) |
max->min
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/RequestThrottler.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/RequestThrottler.ts b/src/util/RequestThrottler.ts index 48a607296..d44109bee 100644 --- a/src/util/RequestThrottler.ts +++ b/src/util/RequestThrottler.ts @@ -51,9 +51,9 @@ class OriginState { private refill(): void { const now = getTimestampNow(); const d = now.t_ms - this.lastUpdate.t_ms; - this.tokensSecond = Math.max(MAX_PER_SECOND, this.tokensSecond + (d / 1000)); - this.tokensMinute = Math.max(MAX_PER_MINUTE, this.tokensMinute + (d / 1000 * 60)); - this.tokensHour = Math.max(MAX_PER_HOUR, this.tokensHour + (d / 1000 * 60 * 60)); + this.tokensSecond = Math.min(MAX_PER_SECOND, this.tokensSecond + (d / 1000)); + this.tokensMinute = Math.min(MAX_PER_MINUTE, this.tokensMinute + (d / 1000 * 60)); + this.tokensHour = Math.min(MAX_PER_HOUR, this.tokensHour + (d / 1000 * 60 * 60)); this.lastUpdate = now; } |