From b43776f007338b9039dcb5851985f577645cadab Mon Sep 17 00:00:00 2001 From: Wietse Wind Date: Wed, 11 Oct 2023 02:41:33 +0200 Subject: [PATCH] Prevent background restarting, allow retry quit --- index.mjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.mjs b/index.mjs index 9433ea6..4fb31c7 100644 --- a/index.mjs +++ b/index.mjs @@ -106,8 +106,15 @@ if (!sigintEventHandler) { const quit = () => { if (!quitting) { + clearTimeout(aliveInterval) + quitting = true + // Allow for re-quit shortly after + setTimeout(() => { + quitting = false + }, 1000) + console.log('Closing (interrupting) connections', connections.length) connections .map(async c => {