From 24facc79d70d0c342d2452f0787d57b08d09c37c Mon Sep 17 00:00:00 2001 From: LouisLam Date: Thu, 9 Sep 2021 11:57:23 +0800 Subject: [PATCH] sendHeartbeatList use raw data --- server/client.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server/client.js b/server/client.js index 4f28a2fa0..e83d1f59a 100644 --- a/server/client.js +++ b/server/client.js @@ -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);