mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-02-08 18:59:22 -05:00
removed unneccesory comment
This commit is contained in:
parent
ae7f01b3ea
commit
bb499e2aa1
@ -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
|
||||
|
@ -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;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user