From a6944f125b43e5ea27f35dba54f1a57a088a0e91 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 29 Jan 2021 12:55:24 +0000 Subject: [PATCH] fix: unref nat manager retries The retry operation in the NAT Manager can prevent node from shutting down, so unref the retries so they don't keep adding work to the event loop. --- src/nat-manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nat-manager.js b/src/nat-manager.js index 760a3f71..93c0251f 100644 --- a/src/nat-manager.js +++ b/src/nat-manager.js @@ -138,9 +138,9 @@ class NatManager { this._client = { // these are all network operations so add a retry - map: (...args) => retry(() => map(...args), { onFailedAttempt: log.error }), - destroy: (...args) => retry(() => destroy(...args), { onFailedAttempt: log.error }), - externalIp: (...args) => retry(() => externalIp(...args), { onFailedAttempt: log.error }) + map: (...args) => retry(() => map(...args), { onFailedAttempt: log.error, unref: true }), + destroy: (...args) => retry(() => destroy(...args), { onFailedAttempt: log.error, unref: true }), + externalIp: (...args) => retry(() => externalIp(...args), { onFailedAttempt: log.error, unref: true }) } return this._client