sendHeartbeatList use raw data

This commit is contained in:
LouisLam 2021-09-09 11:57:23 +08:00
parent 9f9c1007d7
commit 24facc79d7
1 changed files with 4 additions and 7 deletions

View File

@ -32,19 +32,16 @@ async function sendNotificationList(socket) {
async function sendHeartbeatList(socket, monitorID, toUser = false, overwrite = false) {
const timeLogger = new TimeLogger();
let list = await R.find("heartbeat", `
monitor_id = ?
let list = await R.getAll(`
SELECT * FROM heartbeat
WHERE monitor_id = ?
ORDER BY time DESC
LIMIT 100
`, [
monitorID,
])
let result = [];
for (let bean of list) {
result.unshift(bean.toJSON());
}
let result = list.reverse();
if (toUser) {
io.to(socket.userID).emit("heartbeatList", monitorID, result, overwrite);