Merge pull request #255 from bluewave-labs/fix/job-queue-edit-monitor

Replace job in queue when monitor is edited, resolves #254
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-07-04 09:57:47 -07:00
commit 6509043b1f
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)
await req.jobQueue.deleteJob(editedMonitor);
// Add the new job back to the queue
await req.jobQueue.addJob(editedMonitor._id, editedMonitor);
return res.status(200).json({
success: true,
msg: successMessages.MONITOR_EDIT,