debugger: allow longer time to connect

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 <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>
This commit is contained in:
Rich Trott authored and Richard Lau committed 2021-07-20 07:11:16 -04:00
1 parent b172e6f436
commit 22afb7cbe6
1 file changed
+3 -3
+3 -3
View File
@@ -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);
});
};