Skip to content

Commit

Permalink
Merge branch 'main' of github.com:mmatloch/iot
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatloch committed Aug 10, 2024
2 parents da15d15 + a308455 commit 28e170f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ export const createEventSchedulerTaskProcessor = () => {
eventSchedulerTask: task,
});

let updatedTask: EventSchedulerTask;

try {
await eventSchedulerTasksService.update(task, {
updatedTask = await eventSchedulerTasksService.update(task, {
state: EventSchedulerTaskState.Running,
});
} catch (e) {
Expand All @@ -97,14 +99,14 @@ export const createEventSchedulerTaskProcessor = () => {
const context = {};
await eventTriggerInNewContext(task.event, context);

taskQueue.delete(task._id);
taskQueue.delete(updatedTask._id);

try {
await eventSchedulerTasksService.remove(task);
await eventSchedulerTasksService.remove(updatedTask);
} catch (e) {
logger.error({
msg: `Failed to remove task`,
eventSchedulerTask: task,
eventSchedulerTask: updatedTask,
err: e,
});
}
Expand Down

0 comments on commit 28e170f

Please sign in to comment.