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()])
.then(([statusRow, machineStatus]) => {
if (!statusRow) return {up: false, lastPing: null, machineStatus}
const age = moment.duration(statusRow.age, 'seconds')
const up = statusRow.age < CONSIDERED_UP_SECS
const lastPing = age.humanize()
const age = statusRow && moment.duration(statusRow.age, 'seconds')
const up = statusRow ? statusRow.age < CONSIDERED_UP_SECS : false
const lastPing = statusRow && age.humanize()
return settingsLoader.loadLatest()
.then(settings => {