mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-02 03:26:31 -04:00
improve page load performance of large amount urls (#5025)
Co-authored-by: vishal sabhaya <vishals@vebuin.com> Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
f791d4a9bf
commit
d0067a0a12
6 changed files with 225 additions and 68 deletions
|
@ -726,7 +726,7 @@ let needSetup = false;
|
|||
|
||||
await updateMonitorNotification(bean.id, notificationIDList);
|
||||
|
||||
await server.sendMonitorList(socket);
|
||||
await server.sendUpdateMonitorIntoList(socket, bean.id);
|
||||
|
||||
if (monitor.active !== false) {
|
||||
await startMonitor(socket.userID, bean.id);
|
||||
|
@ -879,11 +879,11 @@ let needSetup = false;
|
|||
|
||||
await updateMonitorNotification(bean.id, monitor.notificationIDList);
|
||||
|
||||
if (await bean.isActive()) {
|
||||
if (await Monitor.isActive(bean.id, bean.active)) {
|
||||
await restartMonitor(socket.userID, bean.id);
|
||||
}
|
||||
|
||||
await server.sendMonitorList(socket);
|
||||
await server.sendUpdateMonitorIntoList(socket, bean.id);
|
||||
|
||||
callback({
|
||||
ok: true,
|
||||
|
@ -923,14 +923,17 @@ let needSetup = false;
|
|||
|
||||
log.info("monitor", `Get Monitor: ${monitorID} User ID: ${socket.userID}`);
|
||||
|
||||
let bean = await R.findOne("monitor", " id = ? AND user_id = ? ", [
|
||||
let monitor = await R.findOne("monitor", " id = ? AND user_id = ? ", [
|
||||
monitorID,
|
||||
socket.userID,
|
||||
]);
|
||||
|
||||
const monitorData = [{ id: monitor.id,
|
||||
active: monitor.active
|
||||
}];
|
||||
const preloadData = await Monitor.preparePreloadData(monitorData);
|
||||
callback({
|
||||
ok: true,
|
||||
monitor: await bean.toJSON(),
|
||||
monitor: monitor.toJSON(preloadData),
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
|
@ -981,7 +984,7 @@ let needSetup = false;
|
|||
try {
|
||||
checkLogin(socket);
|
||||
await startMonitor(socket.userID, monitorID);
|
||||
await server.sendMonitorList(socket);
|
||||
await server.sendUpdateMonitorIntoList(socket, monitorID);
|
||||
|
||||
callback({
|
||||
ok: true,
|
||||
|
@ -1001,7 +1004,7 @@ let needSetup = false;
|
|||
try {
|
||||
checkLogin(socket);
|
||||
await pauseMonitor(socket.userID, monitorID);
|
||||
await server.sendMonitorList(socket);
|
||||
await server.sendUpdateMonitorIntoList(socket, monitorID);
|
||||
|
||||
callback({
|
||||
ok: true,
|
||||
|
@ -1047,8 +1050,7 @@ let needSetup = false;
|
|||
msg: "successDeleted",
|
||||
msgi18n: true,
|
||||
});
|
||||
|
||||
await server.sendMonitorList(socket);
|
||||
await server.sendDeleteMonitorFromList(socket, monitorID);
|
||||
|
||||
} catch (e) {
|
||||
callback({
|
||||
|
@ -1678,13 +1680,13 @@ async function afterLogin(socket, user) {
|
|||
|
||||
await StatusPage.sendStatusPageList(io, socket);
|
||||
|
||||
const monitorPromises = [];
|
||||
for (let monitorID in monitorList) {
|
||||
await sendHeartbeatList(socket, monitorID);
|
||||
monitorPromises.push(sendHeartbeatList(socket, monitorID));
|
||||
monitorPromises.push(Monitor.sendStats(io, monitorID, user.id));
|
||||
}
|
||||
|
||||
for (let monitorID in monitorList) {
|
||||
await Monitor.sendStats(io, monitorID, user.id);
|
||||
}
|
||||
await Promise.all(monitorPromises);
|
||||
|
||||
// Set server timezone from client browser if not set
|
||||
// It should be run once only
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue