Fix concurrency error with updating monitor, uncomment out code in pageSpeedMonitorSlice

This commit is contained in:
Alex Holliday committed 2024-10-28 15:37:21 +08:00
1 parent 86ab22df03
commit 8730ee9de2
1 file changed
+6 -3
+6 -3
View File
@@ -296,9 +296,12 @@ const getMonitorById = async (monitorId) => {
const notifications = await Notification.find({ const notifications = await Notification.find({
monitorId: monitorId, monitorId: monitorId,
}); });
monitor.notifications = notifications; const updatedMonitor = await Monitor.findByIdAndUpdate(
const monitorWithNotifications = await monitor.save(); monitorId,
return monitorWithNotifications; { notifications },
{ new: true }
).populate("notifications");
return updatedMonitor;
} catch (error) { } catch (error) {
error.service = SERVICE_NAME; error.service = SERVICE_NAME;
error.method = "getMonitorById"; error.method = "getMonitorById";