From 75506e1ec9079a56d53c08ebb391aed019584022 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 29 Aug 2023 15:29:55 +0200 Subject: [PATCH] improve cache paths --- backend/windmill-worker/src/worker.rs | 5 ++--- backend/windmill-worker/src/worker_flow.rs | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index f58a4a4978..bab689e7d6 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -986,7 +986,6 @@ async fn handle_queued_job( let cached_res_path = if job.cache_ttl.is_some() { let args_hash = hash_args(&job.args.clone().unwrap_or_else(|| json!({}))); - let permissioned_as = &job.permissioned_as; if job.is_flow_step { let flow_path = sqlx::query_scalar!( "SELECT script_path FROM queue WHERE id = $1", @@ -997,10 +996,10 @@ async fn handle_queued_job( .map_err(|e| Error::InternalErr(format!("fetching step flow status: {e}")))? .ok_or_else(|| Error::InternalErr(format!("Expected script_path")))?; let step = step.unwrap_or(-1); - Some(format!("{permissioned_as}/cache/{flow_path}/{step}/{args_hash}")) + Some(format!("{flow_path}/cache/{step}/{args_hash}")) } else if let Some(script_path) = &job.script_path { let is_flow = if job.is_flow() { "flow/" } else { "" }; - Some(format!("{permissioned_as}/cache/{is_flow}{script_path}/{args_hash}")) + Some(format!("{script_path}/{is_flow}cache/{args_hash}")) } else { None } diff --git a/backend/windmill-worker/src/worker_flow.rs b/backend/windmill-worker/src/worker_flow.rs index 5e3eb341cd..82fdb9f621 100644 --- a/backend/windmill-worker/src/worker_flow.rs +++ b/backend/windmill-worker/src/worker_flow.rs @@ -584,9 +584,8 @@ pub async fn update_flow_status_after_job_completion_internal< if flow_job.cache_ttl.is_some() { let cached_res_path = { let args_hash = hash_args(&flow_job.args.clone().unwrap_or_else(|| json!({}))); - let permissioned_as = &flow_job.permissioned_as; let flow_path = flow_job.script_path(); - format!("{permissioned_as}/cache/flow/{flow_path}/{args_hash}") + format!("{flow_path}/flow/cache/{args_hash}") }; save_in_cache(&client, &flow_job, cached_res_path, &nresult).await;