Chore: refactor to use new schema changing queries

This commit is contained in:
csrapr 2021-03-01 15:55:29 +00:00 committed by Josh Harvey
parent 304f792484
commit e6059be8d2
44 changed files with 185 additions and 171 deletions

View file

@ -20,7 +20,7 @@ function machinesLastPing () {
from machine_events
group by device_id`
return Promise.all([machineLoader.getMachineNames(), db.any(sql)])
return Promise.all([machineLoader.getMachineNames(), db.$any(sql)])
.then(([machines, events]) => {
if (machines.length === 0) return 'No paired machines'
@ -52,7 +52,7 @@ function status () {
order by created desc
limit 1`
return Promise.all([checkWasConfigured(), db.oneOrNone(sql, ['ping']), machinesLastPing()])
return Promise.all([checkWasConfigured(), db.$oneOrNone(sql, ['ping']), machinesLastPing()])
.then(([wasConfigured, statusRow, machineStatus]) => {
const age = statusRow && moment.duration(statusRow.age, 'seconds')
const up = statusRow ? statusRow.age < CONSIDERED_UP_SECS : false