mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +02:00
Reaper decides if a device is present or not. Allows devices to "come back to life" if they start beating again.
This commit is contained in:
parent
2b84476c42
commit
736b6f769e
8 changed files with 149 additions and 26 deletions
|
@ -120,14 +120,15 @@ dbapi.saveDeviceLog = function(serial, entry) {
|
|||
}))
|
||||
}
|
||||
|
||||
dbapi.saveDevice = function(serial, device) {
|
||||
dbapi.saveDeviceInitialState = function(serial, device) {
|
||||
var data = {
|
||||
present: true
|
||||
present: false
|
||||
, presenceChangedAt: r.now()
|
||||
, provider: device.provider
|
||||
, owner: null
|
||||
, status: device.status
|
||||
, ready: false
|
||||
, statusChangedAt: r.now()
|
||||
, ready: false
|
||||
, reverseForwards: []
|
||||
}
|
||||
return db.run(r.table('devices').get(serial).update(data))
|
||||
|
@ -160,10 +161,17 @@ dbapi.unsetDeviceOwner = function(serial) {
|
|||
}))
|
||||
}
|
||||
|
||||
dbapi.setDevicePresent = function(serial) {
|
||||
return db.run(r.table('devices').get(serial).update({
|
||||
present: true
|
||||
, presenceChangedAt: r.now()
|
||||
}))
|
||||
}
|
||||
|
||||
dbapi.setDeviceAbsent = function(serial) {
|
||||
return db.run(r.table('devices').get(serial).update({
|
||||
present: false
|
||||
, ready: false
|
||||
, presenceChangedAt: r.now()
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue