Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
fix(launcher) workers fail to launch after tunnel
Browse files Browse the repository at this point in the history
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 #42
  • Loading branch information
aminer-looker committed Oct 20, 2015
1 parent 9995615 commit 4cf2caa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ 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
}
})

emitter.on('exit', function (done) {
log.debug('Shutting down the tunnel.')
tunnel.stop(function (error) {
tunnel.stop(function(error) {
if (error) {
log.error(error)
}
Expand Down

0 comments on commit 4cf2caa

Please sign in to comment.