Replace job in queue when monitor is edited

This commit is contained in:
Alex Holliday committed 2024-07-03 13:55:44 -07:00
1 parent eb8aa4725a
commit 5d24f3136c
1 file changed
+4
+4
View File
@@ -214,6 +214,10 @@ const editMonitor = async (req, res, next) => {
try {
const editedMonitor = await req.db.editMonitor(req, res);
// Delete the old job(editedMonitor has the same ID as the old monitor)
req.jobQueue.deleteJob(editedMonitor);
// Add the new job back to the queue
req.jobQueue.addJob(editedMonitor._id, editedMonitor);
return res.status(200).json({
success: true,
msg: successMessages.MONITOR_EDIT,