mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
Don't rely on lucky timings when sending messages from the provider.
This commit is contained in:
parent
36d0af71b5
commit
91097dc569
6 changed files with 153 additions and 84 deletions
|
@ -84,6 +84,12 @@ dbapi.setDeviceAbsent = function(serial) {
|
|||
}))
|
||||
}
|
||||
|
||||
dbapi.setDeviceChannel = function(serial, channel) {
|
||||
return db.run(r.table('devices').get(serial).update({
|
||||
channel: channel
|
||||
}))
|
||||
}
|
||||
|
||||
dbapi.saveDeviceIdentity = function(serial, identity) {
|
||||
return db.run(r.table('devices').get(serial).update({
|
||||
platform: identity.platform
|
||||
|
@ -105,16 +111,4 @@ dbapi.loadDevice = function(serial) {
|
|||
return db.run(r.table('devices').get(serial))
|
||||
}
|
||||
|
||||
dbapi.ensureDeviceSaved = function(serial) {
|
||||
return dbapi.loadDevice(serial)
|
||||
.then(function(device) {
|
||||
if (!device) {
|
||||
return Promise.delay(100).then(function() {
|
||||
return dbapi.loadDevice(serial)
|
||||
})
|
||||
}
|
||||
return device
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = dbapi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue