From 824d524e401e197e25260a939d8b8d27ddd6ae7c Mon Sep 17 00:00:00 2001 From: Andrew Miner Date: Tue, 20 Oct 2015 09:39:23 -0700 Subject: [PATCH] fix(launcher) workers fail to launch after tunnel In some environments, the process which establishes the tunnel can report that it is operational significantly before the tunnel is actually established. This will cause subsequent calls to create a worker to fail. This change waits a short interval after the tunnel process has reported itself started to allow it to actually finish establishing the tunnel before attempting to create any workers. Fixes karma-runner/karma-browserstack-launcher#42 --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 7b22457..3340b23 100644 --- a/index.js +++ b/index.js @@ -38,8 +38,10 @@ var createBrowserStackTunnel = function (logger, config, emitter) { log.error('Can not establish the tunnel.\n%s', error.toString()) deferred.reject(error) } else { - log.debug('Tunnel established.') - deferred.resolve() + setTimeout(function() { + log.debug('Tunnel established.') + deferred.resolve() + }, 2000) // Give the tunnel time to become actually established } })