diff --git a/src/util/limiter.ts b/src/util/limiter.ts index 32c6c7815..f241f5e53 100644 --- a/src/util/limiter.ts +++ b/src/util/limiter.ts @@ -9,12 +9,14 @@ export class Limiter { this.limit = limit } use (count: number) { - count = +count || 0 - assert(this.base + count <= this.limit, this.message) - this.base += count + if (+count > 0) { + assert(this.base + +count <= this.limit, this.message) + this.base += +count + } } check (count: number) { - count = +count || 0 - assert(count <= this.limit, this.message) + if (+count > 0) { + assert(+count <= this.limit, this.message) + } } }