few bug fixes

This commit is contained in:
Josh Harvey 2017-03-22 15:19:12 +02:00
parent fe1ed536c5
commit c3cd705bc9
3 changed files with 3960 additions and 7 deletions

View file

@ -40,11 +40,9 @@ function status () {
return Promise.all([db.oneOrNone(sql, ['ping']), machinesLastPing()]) return Promise.all([db.oneOrNone(sql, ['ping']), machinesLastPing()])
.then(([statusRow, machineStatus]) => { .then(([statusRow, machineStatus]) => {
if (!statusRow) return {up: false, lastPing: null, machineStatus} const age = statusRow && moment.duration(statusRow.age, 'seconds')
const up = statusRow ? statusRow.age < CONSIDERED_UP_SECS : false
const age = moment.duration(statusRow.age, 'seconds') const lastPing = statusRow && age.humanize()
const up = statusRow.age < CONSIDERED_UP_SECS
const lastPing = age.humanize()
return settingsLoader.loadLatest() return settingsLoader.loadLatest()
.then(settings => { .then(settings => {

View file

@ -79,7 +79,7 @@ function loadLatestConfig () {
order by id desc order by id desc
limit 1` limit 1`
db.oneOrNone(sql, ['config']) return db.oneOrNone(sql, ['config'])
.then(row => row ? row.data.config : []) .then(row => row ? row.data.config : [])
} }

File diff suppressed because one or more lines are too long