Add timeouts everywhere. Should help if the ADB socket gets stuck like it sometimes does.

This commit is contained in:
Simo Kinnunen
2014-04-02 11:58:53 +09:00
parent 64d4782436
commit 0ce65687c5
10 changed files with 51 additions and 5 deletions

View File

@@ -27,12 +27,14 @@ module.exports = syrup.serial()
function openService() {
log.info('Launching HTTP API')
return devutil.ensureUnusedPort(adb, options.serial, service.port)
.timeout(10000)
.then(function() {
return adb.shell(options.serial, [
remote.bin
, '--lib', remote.lib
, '--listen-http', service.port
])
.timeout(10000)
.then(function(out) {
lifecycle.share('Remote shell', out)
streamutil.talk(log, 'Remote shell says: "%s"', out)
@@ -40,6 +42,7 @@ module.exports = syrup.serial()
.then(function() {
return devutil.waitForPort(adb, options.serial, service.port)
})
.timeout(20000)
.then(function(conn) {
var ours = options.ports.pop()
, everyones = options.ports.pop()
@@ -62,6 +65,7 @@ module.exports = syrup.serial()
, util.format('tcp:%d', ours)
, util.format('tcp:%d', service.port)
)
.timeout(10000)
.then(function() {
log.info(
'Opening HTTP API proxy on "http://%s:%s"'
@@ -113,6 +117,7 @@ module.exports = syrup.serial()
)
, json: true
})
.timeout(10000)
.then(function(args) {
var display = args[1]
assert.ok('id' in display, 'Invalid response from HTTP API')