Skip to content

Commit

Permalink
debugger: allow longer time to connect
Browse files Browse the repository at this point in the history
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: #38161
Refs: #36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
Trott authored and targos committed Apr 29, 2021
1 parent def85da commit 6fff9ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/internal/inspector/_inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};
Expand Down

0 comments on commit 6fff9ff

Please sign in to comment.