mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
Fix direct device control not extending owner timeout.
This commit is contained in:
parent
9239ee57b4
commit
3ea41c1a4e
4 changed files with 31 additions and 13 deletions
|
@ -10,13 +10,14 @@ var grouputil = require('../../../util/grouputil')
|
|||
var lifecycle = require('../../../util/lifecycle')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('./solo'))
|
||||
.dependency(require('./identity'))
|
||||
.dependency(require('./service'))
|
||||
.dependency(require('../support/router'))
|
||||
.dependency(require('../support/push'))
|
||||
.dependency(require('../support/sub'))
|
||||
.dependency(require('../support/channels'))
|
||||
.define(function(options, identity, service, router, push, sub, channels) {
|
||||
.define(function(options, solo, ident, service, router, push, sub, channels) {
|
||||
var log = logger.createLogger('device:plugins:group')
|
||||
, currentGroup = null
|
||||
, plugin = new events.EventEmitter()
|
||||
|
@ -44,7 +45,11 @@ module.exports = syrup.serial()
|
|||
log.important('Now owned by "%s"', currentGroup.email)
|
||||
log.info('Subscribing to group channel "%s"', currentGroup.group)
|
||||
|
||||
channels.register(currentGroup.group, timeout || options.groupTimeout)
|
||||
channels.register(currentGroup.group, {
|
||||
timeout: timeout || options.groupTimeout
|
||||
, alias: solo.channel
|
||||
})
|
||||
|
||||
sub.subscribe(currentGroup.group)
|
||||
|
||||
push.send([
|
||||
|
@ -98,7 +103,7 @@ module.exports = syrup.serial()
|
|||
router
|
||||
.on(wire.GroupMessage, function(channel, message) {
|
||||
var reply = wireutil.reply(options.serial)
|
||||
grouputil.match(identity, message.requirements)
|
||||
grouputil.match(ident, message.requirements)
|
||||
.then(function() {
|
||||
return plugin.join(message.owner, message.timeout)
|
||||
})
|
||||
|
@ -123,7 +128,7 @@ module.exports = syrup.serial()
|
|||
})
|
||||
.on(wire.UngroupMessage, function(channel, message) {
|
||||
var reply = wireutil.reply(options.serial)
|
||||
grouputil.match(identity, message.requirements)
|
||||
grouputil.match(ident, message.requirements)
|
||||
.then(function() {
|
||||
return plugin.leave()
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue