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:
parent
f056e0d2ca
commit
a4725fe71c
1 changed files with 20 additions and 14 deletions
|
@ -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] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue