fix: pause malformed scheduled tasks
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
getDueTasks,
|
||||
getTaskById,
|
||||
logTaskRun,
|
||||
updateTask,
|
||||
updateTaskAfterRun,
|
||||
} from './db.js';
|
||||
import { GroupQueue } from './group-queue.js';
|
||||
@@ -39,6 +40,8 @@ async function runTask(
|
||||
groupDir = resolveGroupFolderPath(task.group_folder);
|
||||
} catch (err) {
|
||||
const error = err instanceof Error ? err.message : String(err);
|
||||
// Stop retry churn for malformed legacy rows.
|
||||
updateTask(task.id, { status: 'paused' });
|
||||
logger.error(
|
||||
{ taskId: task.id, groupFolder: task.group_folder, error },
|
||||
'Task has invalid group folder',
|
||||
@@ -237,3 +240,8 @@ export function startSchedulerLoop(deps: SchedulerDependencies): void {
|
||||
|
||||
loop();
|
||||
}
|
||||
|
||||
/** @internal - for tests only. */
|
||||
export function _resetSchedulerLoopForTests(): void {
|
||||
schedulerRunning = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user