fix: stop running deleted script versions from worker caches (#11456)

* fix: stop running deleted script versions from worker caches

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor: reuse script cache invalidate and test the deletion notify payload

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: keep a deleted copy from shadowing the same hash in another workspace

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: drop deletions missed while down and fills racing the eviction

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: batch deletion events, evict path caches and cover version pruning

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: evict the raw-import cache on both passes and split large deletion events

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-10-01 13:37:00 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 840567fbe5
commit d2830cb4a0
10 changed files with 270 additions and 39 deletions
@@ -14367,18 +14367,27 @@ async fn prune_versions(
let pruned = match req.resource_type.as_str() {
"scripts" => {
let result = sqlx::query(
"DELETE FROM script
WHERE workspace_id = $1 AND hash NOT IN (
SELECT DISTINCT ON (path) hash FROM script
WHERE workspace_id = $1 AND deleted = false
ORDER BY path, created_at DESC
)",
)
.bind(&w_id)
.execute(&db)
.await?;
result.rows_affected()
let mut tx = db.begin().await?;
let deleted = windmill_common::DeletedScriptVersions::new(
&w_id,
sqlx::query_as::<_, (String, i64)>(
"DELETE FROM script
WHERE workspace_id = $1 AND hash NOT IN (
SELECT DISTINCT ON (path) hash FROM script
WHERE workspace_id = $1 AND deleted = false
ORDER BY path, created_at DESC
)
RETURNING path, hash",
)
.bind(&w_id)
.fetch_all(&mut *tx)
.await?,
);
deleted.notify(&mut *tx).await?;
tx.commit().await?;
let pruned = deleted.hashes.len() as u64;
deleted.evict();
pruned
}
"flows" => {
let deleted = sqlx::query(