From bb499e2aa1f0775b9e6ab3e6044d6cb85df80a7a Mon Sep 17 00:00:00 2001 From: vishalsabhaya Date: Tue, 3 Sep 2024 16:40:39 +0900 Subject: [PATCH] removed unneccesory comment --- server/server.js | 3 --- server/uptime-kuma-server.js | 7 ------- 2 files changed, 10 deletions(-) diff --git a/server/server.js b/server/server.js index 7440f9e6..6165e4ba 100644 --- a/server/server.js +++ b/server/server.js @@ -1646,10 +1646,8 @@ async function afterLogin(socket, user) { await StatusPage.sendStatusPageList(io, socket); - // Create an array to store the combined promises for both sendHeartbeatList and sendStats const monitorPromises = []; for (let monitorID in monitorList.list) { - // Combine both sendHeartbeatList and sendStats for each monitor into a single Promise monitorPromises.push( Promise.all([ sendHeartbeatList(socket, monitorID), @@ -1658,7 +1656,6 @@ async function afterLogin(socket, user) { ); } - // Await all combined promises await Promise.all(monitorPromises); // Set server timezone from client browser if not set diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index 33ff3eae..0377f5d2 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -227,11 +227,9 @@ class UptimeKumaServer { async getMonitorJSONList(userID, monitorID = null) { let result = {}; - // Initialize query and parameters let query = " user_id = ? "; let queryParams = [ userID ]; - // Add condition for monitorID if provided if (monitorID) { query += "AND id = ? "; queryParams.push(monitorID); @@ -239,24 +237,19 @@ class UptimeKumaServer { let monitorList = await R.find("monitor", query + "ORDER BY weight DESC, name", queryParams); - // Collect monitor IDs - // Create monitorData with id, active const monitorData = monitorList.map(monitor => ({ id: monitor.id, active: monitor.active, })); const preloadData = await Monitor.preparePreloadData(monitorData); - // Create an array of promises to convert each monitor to JSON in parallel const monitorPromises = monitorList.map(monitor => monitor.toJSON(preloadData).then(json => { return { id: monitor.id, json }; })); - // Wait for all promises to resolve const monitors = await Promise.all(monitorPromises); - // Populate the result object with monitor IDs as keys, JSON objects as values monitors.forEach(monitor => { result[monitor.id] = monitor.json; });