From b87a498087f47e9ff8069fe9af804516f00be1bc Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 26 Sep 2022 00:45:26 +0200 Subject: [PATCH] do not restart flow as zombie job --- backend/sqlx-data.json | 23 ----------------------- backend/src/worker.rs | 3 ++- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/backend/sqlx-data.json b/backend/sqlx-data.json index 667af5ddc4..dbe5cb2376 100644 --- a/backend/sqlx-data.json +++ b/backend/sqlx-data.json @@ -2542,29 +2542,6 @@ }, "query": "SELECT * from workspace_invite WHERE workspace_id = $1" }, - "b546ee85fb214887ffcf81614518cf5dc3a566e1042df8f3c9ae227c3f3d9bf2": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Uuid" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Varchar", - "Text", - "Uuid", - "Text" - ] - } - }, - "query": "UPDATE queue SET canceled = true, canceled_by = $1, canceled_reason = $2 WHERE id = $3 AND schedule_path IS NULL AND workspace_id = $4 RETURNING id" - }, "b7dd791cd69748ef51b7520f505c0c8bb1b4014a273476eddfecf1ab658a18b4": { "describe": { "columns": [ diff --git a/backend/src/worker.rs b/backend/src/worker.rs index 56ebe6645a..2383f088e1 100644 --- a/backend/src/worker.rs +++ b/backend/src/worker.rs @@ -1652,8 +1652,9 @@ pub async fn restart_zombie_jobs_periodically( ) { loop { let restarted = sqlx::query!( - "UPDATE queue SET running = false WHERE last_ping < now() - ($1 || ' seconds')::interval and running = true RETURNING id, workspace_id, last_ping", + "UPDATE queue SET running = false WHERE last_ping < now() - ($1 || ' seconds')::interval AND running = true AND job_kind != $2 RETURNING id, workspace_id, last_ping", (timeout * 5).to_string(), + JobKind::Flow: JobKind, ) .fetch_all(db) .await