fix: propagate queue cancel to run state
This commit is contained in:
@@ -985,8 +985,8 @@ CREATE TABLE IF NOT EXISTS agentrun_schema_migrations (
|
||||
async cancelQueueTask(taskId: string, reason = "cancel requested"): Promise<QueueTaskRecord> {
|
||||
const task = await this.getQueueTask(taskId);
|
||||
if (isTerminalQueueTaskState(task.state)) return task;
|
||||
if (task.latestAttempt?.commandId) await this.cancelCommand(task.latestAttempt.commandId, reason);
|
||||
else if (task.latestAttempt?.runId) await this.cancelRun(task.latestAttempt.runId, reason);
|
||||
if (task.latestAttempt?.runId) await this.cancelRun(task.latestAttempt.runId, reason);
|
||||
else if (task.latestAttempt?.commandId) await this.cancelCommand(task.latestAttempt.commandId, reason);
|
||||
return this.withTransaction(async (client) => {
|
||||
const existing = await client.query("SELECT * FROM agentrun_queue_tasks WHERE id = $1 FOR UPDATE", [taskId]);
|
||||
const row = existing.rows[0];
|
||||
|
||||
Reference in New Issue
Block a user