add pings table
This commit is contained in:
parent
31f7795fd7
commit
a123170622
4 changed files with 43 additions and 13 deletions
|
|
@ -165,14 +165,14 @@ function plugins (settings, deviceId) {
|
|||
.then(row => row.id)
|
||||
}
|
||||
|
||||
function pollQueries (deviceTime, deviceRec) {
|
||||
function pollQueries (serialNumber, deviceTime, deviceRec) {
|
||||
const config = configManager.machineScoped(deviceId, settings.config)
|
||||
const fiatCode = config.fiatCurrency
|
||||
const cryptoCodes = config.cryptoCurrencies
|
||||
|
||||
const tickerPromises = cryptoCodes.map(c => ticker.getRates(settings, fiatCode, c))
|
||||
const balancePromises = cryptoCodes.map(c => fiatBalance(fiatCode, c))
|
||||
const pingPromise = recordPing(deviceTime, deviceRec)
|
||||
const pingPromise = recordPing(serialNumber, deviceTime, deviceRec)
|
||||
const currentConfigVersionPromise = fetchCurrentConfigVersion()
|
||||
|
||||
const promises = [
|
||||
|
|
@ -201,15 +201,15 @@ function plugins (settings, deviceId) {
|
|||
return wallet.sendCoins(settings, tx.toAddress, tx.cryptoAtoms, tx.cryptoCode)
|
||||
}
|
||||
|
||||
function recordPing (deviceTime, rec) {
|
||||
const event = {
|
||||
function recordPing (serialNumber, deviceTime, rec) {
|
||||
const r = {
|
||||
id: uuid.v4(),
|
||||
deviceId,
|
||||
eventType: 'ping',
|
||||
note: JSON.stringify({state: rec.state, isIdle: rec.idle === 'true', txId: rec.txId}),
|
||||
deviceTime
|
||||
device_id: deviceId,
|
||||
serial_number: serialNumber,
|
||||
device_time: deviceTime
|
||||
}
|
||||
return dbm.machineEvent(event)
|
||||
|
||||
return db.none(pgp.helpers.insert(r, null, 'machine_pings'))
|
||||
}
|
||||
|
||||
function isHd (tx) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue