mirror of
https://github.com/openstf/stf
synced 2025-10-03 17:59:28 +02:00
Reap dead devices using timeouts. Previously, if a provider died without being able to clean up properly, the device would stay as a ghost.
This commit is contained in:
parent
f24e777961
commit
4896ca406e
10 changed files with 189 additions and 3 deletions
39
lib/cli.js
39
lib/cli.js
|
@ -95,6 +95,10 @@ program
|
|||
, 'public ip for global access'
|
||||
, String
|
||||
, ip())
|
||||
.option('--heartbeat-interval <ms>'
|
||||
, 'heartbeat interval'
|
||||
, Number
|
||||
, 10000)
|
||||
.action(function(serial, options) {
|
||||
if (!options.connectSub) {
|
||||
this.missingArgument('--connect-sub')
|
||||
|
@ -118,6 +122,7 @@ program
|
|||
sub: options.connectSub
|
||||
, push: options.connectPush
|
||||
}
|
||||
, heartbeatInterval: options.heartbeatInterval
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -147,6 +152,31 @@ program
|
|||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('reaper <name>')
|
||||
.description('start reaper')
|
||||
.option('-p, --connect-push <endpoint>'
|
||||
, 'push endpoint'
|
||||
, cliutil.list)
|
||||
.option('-t, --heartbeat-timeout <ms>'
|
||||
, 'consider devices with heartbeat older than this value dead'
|
||||
, Number
|
||||
, 20000)
|
||||
.option('-i, --reap-interval <ms>'
|
||||
, 'reap interval'
|
||||
, Number
|
||||
, 10000)
|
||||
.action(function(name, options) {
|
||||
require('./roles/reaper')({
|
||||
name: name
|
||||
, heartbeatTimeout: options.heartbeatTimeout
|
||||
, reapInterval: options.reapInterval
|
||||
, endpoints: {
|
||||
push: options.connectPush
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
program
|
||||
.command('triproxy <name>')
|
||||
.description('start triproxy')
|
||||
|
@ -471,6 +501,15 @@ program
|
|||
log.error('processor 002 died', err.stack)
|
||||
})
|
||||
|
||||
// reaper one
|
||||
procutil.fork(__filename, [
|
||||
'reaper', 'reaper001'
|
||||
, '--connect-push', options.bindDevPull
|
||||
])
|
||||
.catch(function(err) {
|
||||
log.error('reaper 001 died', err.stack)
|
||||
})
|
||||
|
||||
// provider
|
||||
procutil.fork(__filename, [
|
||||
'provider'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue