mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-30 07:20:08 +00:00
Bug(utils) Fix bucket refill after the first time (#3097)
* bug(bucket) Fix LeakyBucket refill * Fix formating
This commit is contained in:
@@ -35,9 +35,11 @@ export class LeakyBucket implements LeakyBucketOptions {
|
||||
this.used = this.refillAmount > this.used ? 0 : this.used - this.refillAmount
|
||||
// Reset the refillsAt timestamp since it just got refilled
|
||||
this.refillsAt = undefined
|
||||
// Reset the timeoutId
|
||||
clearTimeout(this.timeoutId)
|
||||
this.timeoutId = undefined;
|
||||
|
||||
if (this.used > 0) {
|
||||
if (this.timeoutId) clearTimeout(this.timeoutId)
|
||||
this.timeoutId = setTimeout(() => {
|
||||
this.refillBucket()
|
||||
}, this.refillInterval)
|
||||
|
||||
Reference in New Issue
Block a user