In-memory reaper. TtlSet needs tests.

This commit is contained in:
Simo Kinnunen
2015-06-01 17:39:59 +09:00
parent 89aedcef06
commit 25544d1a1a
10 changed files with 231 additions and 87 deletions

View File

@@ -126,6 +126,7 @@ module.exports = function(options) {
return false
}
if (options.filter && !options.filter(device)) {
log.info('Filtered out device "%s"', device.id)
return false
}
return listener(device)
@@ -407,19 +408,6 @@ module.exports = function(options) {
lifecycle.share('Tracker', tracker)
})
// This keeps the devices "present" in the database. It relies on the
// provider channel changing on every run so that we never match old
// devices.
;(function heartbeat() {
push.send([
wireutil.heartbeat
, wireutil.envelope(new wire.ProviderHeartbeatMessage(
solo
))
])
setTimeout(heartbeat, options.heartbeatInterval)
})()
lifecycle.observe(function() {
[push, sub].forEach(function(sock) {
try {