mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 16:53:32 +02:00
Make group timeout configurable.
This commit is contained in:
16
lib/cli.js
16
lib/cli.js
@@ -39,6 +39,10 @@ program
|
||||
, 'public ip for global access'
|
||||
, String
|
||||
, ip())
|
||||
.option('-t, --group-timeout <seconds>'
|
||||
, 'group timeout'
|
||||
, Number
|
||||
, 600)
|
||||
.action(function() {
|
||||
var serials = cliutil.allUnknownArgs(arguments)
|
||||
, options = cliutil.lastArg(arguments)
|
||||
@@ -66,6 +70,7 @@ program
|
||||
, '--connect-push', options.connectPush.join(',')
|
||||
, '--ports', ports.join(',')
|
||||
, '--public-ip', options.publicIp
|
||||
, '--group-timeout', options.groupTimeout
|
||||
])
|
||||
}
|
||||
, endpoints: {
|
||||
@@ -98,6 +103,10 @@ program
|
||||
, 'heartbeat interval'
|
||||
, Number
|
||||
, 10000)
|
||||
.option('-t, --group-timeout <seconds>'
|
||||
, 'group timeout'
|
||||
, Number
|
||||
, 600)
|
||||
.action(function(serial, options) {
|
||||
if (!options.connectSub) {
|
||||
this.missingArgument('--connect-sub')
|
||||
@@ -122,6 +131,7 @@ program
|
||||
, push: options.connectPush
|
||||
}
|
||||
, heartbeatInterval: options.heartbeatInterval
|
||||
, groupTimeout: options.groupTimeout * 1000 // change to ms
|
||||
})
|
||||
})
|
||||
|
||||
@@ -407,7 +417,6 @@ program
|
||||
, ssid: options.ssid
|
||||
, authUrl: options.authUrl
|
||||
, storageUrl: options.storageUrl
|
||||
, groupTimeout: 600 * 1000
|
||||
, endpoints: {
|
||||
sub: options.connectSub
|
||||
, push: options.connectPush
|
||||
@@ -520,6 +529,10 @@ program
|
||||
, os.hostname())
|
||||
.option('-d, --disable-watch'
|
||||
, 'disable watching resources')
|
||||
.option('-t, --group-timeout <seconds>'
|
||||
, 'group timeout'
|
||||
, Number
|
||||
, 600)
|
||||
.action(function() {
|
||||
var log = logger.createLogger('cli:local')
|
||||
, args = arguments
|
||||
@@ -574,6 +587,7 @@ program
|
||||
, '--name', options.provider
|
||||
, '--connect-sub', options.bindDevPub
|
||||
, '--connect-push', options.bindDevPull
|
||||
, '--group-timeout', options.groupTimeout
|
||||
].concat(cliutil.allUnknownArgs(args)))
|
||||
|
||||
// auth-mock
|
||||
|
||||
@@ -460,8 +460,8 @@ module.exports = function(options) {
|
||||
, user.name
|
||||
, user.group
|
||||
)
|
||||
, options.groupTimeout
|
||||
, wireutil.toDeviceRequirements(data)
|
||||
, data.timeout || null
|
||||
, wireutil.toDeviceRequirements(data.requirements)
|
||||
)
|
||||
)
|
||||
])
|
||||
@@ -473,7 +473,7 @@ module.exports = function(options) {
|
||||
, wireutil.transaction(
|
||||
responseChannel
|
||||
, new wire.UngroupMessage(
|
||||
wireutil.toDeviceRequirements(data)
|
||||
wireutil.toDeviceRequirements(data.requirements)
|
||||
)
|
||||
)
|
||||
])
|
||||
|
||||
@@ -44,7 +44,7 @@ module.exports = syrup.serial()
|
||||
log.info('Now owned by "%s"', currentGroup.email)
|
||||
log.info('Subscribing to group channel "%s"', currentGroup.group)
|
||||
|
||||
channels.register(currentGroup.group, timeout)
|
||||
channels.register(currentGroup.group, timeout || options.groupTimeout)
|
||||
sub.subscribe(currentGroup.group)
|
||||
|
||||
push.send([
|
||||
|
||||
@@ -210,7 +210,7 @@ message OwnerMessage {
|
||||
|
||||
message GroupMessage {
|
||||
required OwnerMessage owner = 1;
|
||||
required uint32 timeout = 2;
|
||||
optional uint32 timeout = 2;
|
||||
repeated DeviceRequirement requirements = 3;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user