Skip to content

Commit dffd9a8

Browse files
make timeout configurable
1 parent 7baf0e1 commit dffd9a8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/tunnel-launcher.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let activeTunnel
1212
let started = false
1313

1414
const MIN_JAVA_VERSION = 11
15+
const DEFAULT_TIMEOUT = 90
1516

1617
function parseJavaVersion (versionOutput) {
1718
const versionMatch = versionOutput.match(/version "(\d+)/)
@@ -222,6 +223,7 @@ async function startTunnelAsync (options = {}) {
222223
return new Promise((resolve, reject) => {
223224
let waitCounter = 0
224225
let settled = false
226+
const timeout = options.timeout || DEFAULT_TIMEOUT
225227

226228
const onReady = () => {
227229
if (settled) return
@@ -245,7 +247,7 @@ async function startTunnelAsync (options = {}) {
245247
onReady()
246248
} catch {
247249
waitCounter += 1
248-
if (waitCounter > 90) {
250+
if (waitCounter > timeout) {
249251
const errorMessage = `Tunnel failed to launch in ${waitCounter} seconds.`
250252
console.log(errorMessage)
251253
onError(new Error(errorMessage))

0 commit comments

Comments
 (0)