From 8b289a4bc3bbd2d308df574ebae9288426f25136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?charsy=E3=83=81=E3=83=A3=E3=83=BC=E3=82=B7=E3=82=A3?= <28523197+Charsy89@users.noreply.github.com> Date: Mon, 15 Feb 2021 16:52:23 -0700 Subject: [PATCH] Fix typo, clear interval to be safe --- src/Quota.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Quota.js b/src/Quota.js index da24303..f259672 100644 --- a/src/Quota.js +++ b/src/Quota.js @@ -105,8 +105,9 @@ class Quota { var allowance = params.allowance || this.allowance || Quota.PARAMS_OFFLINE.allowance; var max = params.max || this.max || Quota.PARAMS_OFFLINE.max; var maxHistLen = params.maxHistLen || this.maxHistLen || Quota.PARAMS_OFFLINE.maxHistLen; - let interval = params.interval || 0 - this.inverval = setInterval(() => { + let interval = params.interval || 0; + clearInterval(this.interval); + this.interval = setInterval(() => { this.tick(); }, params.interval) if (allowance !== this.allowance || max !== this.max || maxHistLen !== this.maxHistLen) { @@ -155,4 +156,4 @@ class Quota { }; } -module.exports = Quota \ No newline at end of file +module.exports = Quota