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)