1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 18:29:17 +02:00

Detect if we kill device worker before it becomes operational.

This commit is contained in:
Simo Kinnunen 2014-01-28 23:21:39 +09:00
parent f056e0d2ca
commit a4725fe71c

View file

@ -86,10 +86,15 @@ module.exports = function(options) {
proc.on('exit', function(code, signal) { proc.on('exit', function(code, signal) {
var data = workers[device.id] var data = workers[device.id]
delete workers[device.id] delete workers[device.id]
if (code === 0) { switch (code) {
case 0:
log.info('Device worker "%s" stopped cleanly', device.id) log.info('Device worker "%s" stopped cleanly', device.id)
} break
else { case 143: // SIGTERM
log.warn('Device worker "%s" was killed before becoming operational'
, device.id)
break
default:
log.error('Device worker "%s" had a dirty exit (code %d)', log.error('Device worker "%s" had a dirty exit (code %d)',
device.id, code) device.id, code)
if (Date.now() - data.started < 10000) { if (Date.now() - data.started < 10000) {
@ -100,6 +105,7 @@ module.exports = function(options) {
log.info('Restarting worker of "%s"', device.id) log.info('Restarting worker of "%s"', device.id)
maybeConnect(device) maybeConnect(device)
} }
break
} }
}) })
workers[device.id] = { workers[device.id] = {