From 07e3117e22215ec0c2e7fd1541aed8f32f6a5871 Mon Sep 17 00:00:00 2001 From: CyberPhoenix90 Date: Thu, 30 Dec 2021 15:05:09 +0100 Subject: [PATCH 1/2] fix leak that was killing performance over long periods --- src/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index bdb441e7..3aee2b6f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -26,7 +26,10 @@ export default class Utils { /** Function that can be used to wait for a condition before returning. */ async wait(condition: () => T | false, timeout = 5000, check = 100): Promise { return await new Promise((resolve, reject) => { - setTimeout(() => reject("TIMEOUT"), timeout); + setTimeout(() => { + clearInterval(interval); + reject("TIMEOUT") + }, timeout); const intervalCheck = () => { const result = condition(); From 8763d173bda7b68dbadbcf57bf29e3053f00ec13 Mon Sep 17 00:00:00 2001 From: CyberPhoenix90 Date: Thu, 30 Dec 2021 15:22:02 +0100 Subject: [PATCH 2/2] fix missing semi colon --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 3aee2b6f..661ca0bb 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -28,7 +28,7 @@ export default class Utils { return await new Promise((resolve, reject) => { setTimeout(() => { clearInterval(interval); - reject("TIMEOUT") + reject("TIMEOUT"); }, timeout); const intervalCheck = () => {