From fba9e7ef03b91d3e2c78ff833ddcc5207b7436d2 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 3 Mar 2025 23:50:13 +0100 Subject: [PATCH] fix: improve cancel performance --- ...39048c5f42a80a2c538fbb54ad269ec81aea89e431a511245a1e.json} | 4 ++-- backend/windmill-queue/src/jobs.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename backend/.sqlx/{query-c5259e37703c3e48104438bad6e1f3615f4439c090a75e6fde03702a21589b25.json => query-eb68469026be39048c5f42a80a2c538fbb54ad269ec81aea89e431a511245a1e.json} (57%) diff --git a/backend/.sqlx/query-c5259e37703c3e48104438bad6e1f3615f4439c090a75e6fde03702a21589b25.json b/backend/.sqlx/query-eb68469026be39048c5f42a80a2c538fbb54ad269ec81aea89e431a511245a1e.json similarity index 57% rename from backend/.sqlx/query-c5259e37703c3e48104438bad6e1f3615f4439c090a75e6fde03702a21589b25.json rename to backend/.sqlx/query-eb68469026be39048c5f42a80a2c538fbb54ad269ec81aea89e431a511245a1e.json index ee362d8845..60a98ba32a 100644 --- a/backend/.sqlx/query-c5259e37703c3e48104438bad6e1f3615f4439c090a75e6fde03702a21589b25.json +++ b/backend/.sqlx/query-eb68469026be39048c5f42a80a2c538fbb54ad269ec81aea89e431a511245a1e.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT id AS \"id!\" FROM v2_job WHERE parent_job = $1 AND workspace_id = $2", + "query": "SELECT id AS \"id!\" FROM v2_job_queue INNER JOIN v2_job USING (id) WHERE parent_job = $1 AND v2_job.workspace_id = $2", "describe": { "columns": [ { @@ -19,5 +19,5 @@ false ] }, - "hash": "c5259e37703c3e48104438bad6e1f3615f4439c090a75e6fde03702a21589b25" + "hash": "eb68469026be39048c5f42a80a2c538fbb54ad269ec81aea89e431a511245a1e" } diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index e582fa39dc..c676d1e6f7 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -247,7 +247,7 @@ pub async fn cancel_job<'c>( while !jobs.is_empty() { let p_job = jobs.pop(); let new_jobs = sqlx::query_scalar!( - "SELECT id AS \"id!\" FROM v2_job WHERE parent_job = $1 AND workspace_id = $2", + "SELECT id AS \"id!\" FROM v2_job_queue INNER JOIN v2_job USING (id) WHERE parent_job = $1 AND v2_job.workspace_id = $2", p_job, w_id )