max->min
This commit is contained in:
parent
3f71aff19f
commit
99bccae9fe
@ -51,9 +51,9 @@ class OriginState {
|
|||||||
private refill(): void {
|
private refill(): void {
|
||||||
const now = getTimestampNow();
|
const now = getTimestampNow();
|
||||||
const d = now.t_ms - this.lastUpdate.t_ms;
|
const d = now.t_ms - this.lastUpdate.t_ms;
|
||||||
this.tokensSecond = Math.max(MAX_PER_SECOND, this.tokensSecond + (d / 1000));
|
this.tokensSecond = Math.min(MAX_PER_SECOND, this.tokensSecond + (d / 1000));
|
||||||
this.tokensMinute = Math.max(MAX_PER_MINUTE, this.tokensMinute + (d / 1000 * 60));
|
this.tokensMinute = Math.min(MAX_PER_MINUTE, this.tokensMinute + (d / 1000 * 60));
|
||||||
this.tokensHour = Math.max(MAX_PER_HOUR, this.tokensHour + (d / 1000 * 60 * 60));
|
this.tokensHour = Math.min(MAX_PER_HOUR, this.tokensHour + (d / 1000 * 60 * 60));
|
||||||
this.lastUpdate = now;
|
this.lastUpdate = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user