mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +02:00
In-memory reaper. TtlSet needs tests.
This commit is contained in:
parent
89aedcef06
commit
25544d1a1a
10 changed files with 231 additions and 87 deletions
24
lib/units/device/plugins/heartbeat.js
Normal file
24
lib/units/device/plugins/heartbeat.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
var syrup = require('stf-syrup')
|
||||
|
||||
var lifecycle = require('../../../util/lifecycle')
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/push'))
|
||||
.define(function(options, push) {
|
||||
function beat() {
|
||||
push.send([
|
||||
wireutil.global
|
||||
, wireutil.envelope(new wire.DeviceHeartbeatMessage(
|
||||
options.serial
|
||||
))
|
||||
])
|
||||
}
|
||||
|
||||
var timer = setInterval(beat, options.heartbeatInterval)
|
||||
|
||||
lifecycle.observe(function() {
|
||||
clearInterval(timer)
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue