diff --git a/packages/provider/src/util.ts b/packages/provider/src/util.ts index 6c9a5117f..10cdb2d3b 100644 --- a/packages/provider/src/util.ts +++ b/packages/provider/src/util.ts @@ -61,7 +61,10 @@ export async function checkIfTaskIsRunning( taskName, ScheduledTaskStatus.Running, ); - if (runningTask) { + const twoMinutesAgo = new Date().getTime() - 1000 * 60 * 2 + // If the task is running and the task was started within the last 2 minutes + // TODO: This is a temporary fix to prevent failed tasks from blocking the next task + if (runningTask && runningTask.datetime > twoMinutesAgo) { const completedTask = await db.getScheduledTaskStatus( runningTask._id as ObjectId, ScheduledTaskStatus.Completed,