From 22afb7cbe695b47eee1f79da356cb24be926e016 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 21 Apr 2021 16:22:36 -0700 Subject: [PATCH] debugger: allow longer time to connect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make five attempts with a timeout of 1 second each rather than 10 attempts with a timeout of 500ms each. This is to allow for slower-connecting devices like Raspberry Pi. PR-URL: https://github.com/nodejs/node/pull/38161 Backport-PR-URL: https://github.com/nodejs/node/pull/38858 Refs: https://github.com/nodejs/node/discussions/36481 Reviewed-By: Matteo Collina Reviewed-By: Jan Krems Reviewed-By: Colin Ihrig Reviewed-By: Stephen Belanger Reviewed-By: Gerhard Stöbich Reviewed-By: Michaël Zasso --- lib/internal/inspector/_inspect.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/inspector/_inspect.js b/lib/internal/inspector/_inspect.js index b58b4b695e8505..b326a772fd39c9 100644 --- a/lib/internal/inspector/_inspect.js +++ b/lib/internal/inspector/_inspect.js @@ -234,13 +234,13 @@ class NodeInspector { this.stdout.write(' ok\n'); }, (error) => { debuglog('connect failed', error); - // If it's failed to connect 10 times then print failed message - if (connectionAttempts >= 10) { + // If it's failed to connect 5 times then print failed message + if (connectionAttempts >= 5) { this.stdout.write(' failed to connect, please retry\n'); process.exit(1); } - return new Promise((resolve) => setTimeout(resolve, 500)) + return new Promise((resolve) => setTimeout(resolve, 1000)) .then(attemptConnect); }); };