From 588d96fc2a028d9c06ae730e03a359a93b05b6cb Mon Sep 17 00:00:00 2001 From: Alex / KATT Date: Mon, 18 Mar 2024 15:47:07 +0100 Subject: [PATCH] fix: use `unref()` to allow graceful shutdown --- javascript/src/utils/polling.ts | 3 ++- javascript/tsconfig.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/javascript/src/utils/polling.ts b/javascript/src/utils/polling.ts index 116b3ba..08d8f6a 100644 --- a/javascript/src/utils/polling.ts +++ b/javascript/src/utils/polling.ts @@ -6,7 +6,8 @@ const CONNECTION_ERROR_RETRY_MAX_MS = 1000 * 60 * 10 // 10 minutes function sleep(ms: number): Promise { return new Promise((resolve) => { - setTimeout(resolve, ms) + const timeout = setTimeout(resolve, ms) + timeout.unref() }) } diff --git a/javascript/tsconfig.json b/javascript/tsconfig.json index e096887..d374bc1 100644 --- a/javascript/tsconfig.json +++ b/javascript/tsconfig.json @@ -12,6 +12,7 @@ "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, + "lib": ["ESNext"] }, "ts-node": { // these options are overrides used only by ts-node