Skip to content

Commit

Permalink
Fix concurrency error with updating monitor, uncomment out code in pa…
Browse files Browse the repository at this point in the history
…geSpeedMonitorSlice
  • Loading branch information
ajhollid committed Oct 28, 2024
1 parent 86ab22d commit 8730ee9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Server/db/mongo/modules/monitorModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,12 @@ const getMonitorById = async (monitorId) => {
const notifications = await Notification.find({
monitorId: monitorId,
});
monitor.notifications = notifications;
const monitorWithNotifications = await monitor.save();
return monitorWithNotifications;
const updatedMonitor = await Monitor.findByIdAndUpdate(
monitorId,
{ notifications },
{ new: true }
).populate("notifications");
return updatedMonitor;
} catch (error) {
error.service = SERVICE_NAME;
error.method = "getMonitorById";
Expand Down

0 comments on commit 8730ee9

Please sign in to comment.