Reset owner and reverse forwards when a dead worker restarts. This should prevent ghost owners from staying in the device list.

This commit is contained in:
Simo Kinnunen
2015-06-25 17:16:09 +09:00
parent fe7785f003
commit 4a4b0f26d1
5 changed files with 24 additions and 9 deletions

View File

@@ -243,16 +243,18 @@ dbapi.setDeviceReverseForwards = function(serial, forwards) {
}))
}
dbapi.setDeviceChannel = function(serial, channel) {
dbapi.setDeviceReady = function(serial, channel) {
return db.run(r.table('devices').get(serial).update({
channel: channel
, ready: true
, owner: null
, reverseForwards: []
}))
}
dbapi.saveDeviceIdentity = function(serial, identity) {
return db.run(r.table('devices').get(serial).update({
ready: true
, platform: identity.platform
platform: identity.platform
, manufacturer: identity.manufacturer
, operator: identity.operator
, model: identity.model