From bd83bb9fd66ffac83cbb631fc552d30ad4058529 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Wed, 2 May 2018 18:09:51 +0100 Subject: [PATCH] refactor: improve sweep performance --- src/rest/RESTManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rest/RESTManager.js b/src/rest/RESTManager.js index 8f361447f..4ca4cb174 100644 --- a/src/rest/RESTManager.js +++ b/src/rest/RESTManager.js @@ -16,8 +16,8 @@ class RESTManager { if (client.options.restSweepInterval > 0) { client.setInterval(() => { for (const handler in this.handlers) { - if (this.handlers[handler] && this.handlers[handler]._inactive) { - this.handlers[handler] = undefined; + if (this.handlers[handler]._inactive) { + delete this.handlers[handler]; } } }, client.options.restSweepInterval * 1000);