cache last heartbeat list in memory

This commit is contained in:
LouisLam 2021-09-08 18:58:02 +08:00
parent 0bf0cfa104
commit 87678ea92d
5 changed files with 105 additions and 26 deletions

View file

@ -33,13 +33,14 @@ 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 = ?
ORDER BY time DESC
LIMIT 100
`, [
monitorID,
])
let monitor = userMonitorList.getMonitor(socket.userID, monitorID);
if (! monitor) {
console.error("No this monitor??");
return;
}
let list = monitor.getCachedHeartbeatList().array;
let result = [];