Merge branch 'develop' into release-2.1.0

This commit is contained in:
Raccoon 2020-05-17 13:38:03 +08:00
commit 168fdf35c3
2 changed files with 13 additions and 7 deletions

View File

@ -298,10 +298,12 @@ function getStatus () {
}
})
.catch(function (err) {
return logger.error('count user failed: ' + err)
logger.error('count user failed: ' + err)
return Promise.reject(new Error('count user failed: ' + err))
})
}).catch(function (err) {
return logger.error('count note failed: ' + err)
logger.error('count note failed: ' + err)
return Promise.reject(new Error('count note failed: ' + err))
})
}
@ -772,8 +774,7 @@ function queueForConnect (socket) {
const noteId = socket.noteId
logger.info('SERVER connected a client to [' + noteId + ']:')
logger.info(JSON.stringify(user))
// logger.info(notes);
getStatus(function (data) {
getStatus().then(function (data) {
logger.info(JSON.stringify(data))
})
}

View File

@ -4,14 +4,19 @@ const realtime = require('../realtime/realtime')
const config = require('../config')
exports.getStatus = async (req, res) => {
const data = await realtime.getStatus()
res.set({
'Cache-Control': 'private', // only cache by client
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
'Content-Type': 'application/json'
})
res.send(data)
try {
const data = await realtime.getStatus()
res.send(data)
} catch (e) {
console.error(e)
res.status(500).send(e.toString())
}
}
exports.getMetrics = async (req, res) => {