From 0b54ebc73d3d9541d2521857adc27766c4342000 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 17 Oct 2026 10:29:14 +0200 Subject: [PATCH] fix: skip the fork lock when a fork creation has no storage to purge (#11842) * fix: skip the fork lock when a fork creation has no storage to purge Co-Authored-By: Claude Opus 5.5 * fix: word the fork lock skip for both purge callers Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- backend/windmill-api-workspaces/src/workspaces_extra.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/windmill-api-workspaces/src/workspaces_extra.rs b/backend/windmill-api-workspaces/src/workspaces_extra.rs index 0cae90952b..e02d7c8c3e 100644 --- a/backend/windmill-api-workspaces/src/workspaces_extra.rs +++ b/backend/windmill-api-workspaces/src/workspaces_extra.rs @@ -2399,6 +2399,11 @@ pub(crate) async fn purge_fork_storages_unless_live( w_id: &str, prepared: Vec, ) -> Result> { + // The lock only orders a purge against a same-id fork write; with nothing to purge, waiting + // on it would only hold fork creation's answer behind such a write. + if prepared.is_empty() { + return Ok(vec![]); + } let mut lock = db.begin().await?; sqlx::query("SELECT pg_advisory_xact_lock(hashtext('fork:' || $1))") .bind(w_id)