From b5e341fde79d6335c0e27d0adbe0febd49a09d36 Mon Sep 17 00:00:00 2001 From: dieriba Date: Sat, 1 Nov 2025 15:08:34 +0100 Subject: [PATCH] perf: parse flow value only if needed (#7025) * nits * renames --- backend/windmill-api/src/flows.rs | 2 +- backend/windmill-common/src/flows.rs | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/windmill-api/src/flows.rs b/backend/windmill-api/src/flows.rs index 2a7e4d51e3..0f4e8db038 100644 --- a/backend/windmill-api/src/flows.rs +++ b/backend/windmill-api/src/flows.rs @@ -1365,8 +1365,8 @@ async fn archive_flow_by_path( /// Validates that flow debouncing configuration is supported by all workers /// Returns an error if debouncing is configured but workers are behind required version async fn guard_flow_from_debounce_data(nf: &NewFlow) -> Result<()> { - let flow_value = nf.parse_flow_value()?; if !*MIN_VERSION_SUPPORTS_DEBOUNCING.read().await && { + let flow_value = nf.parse_flow_value()?; flow_value.debounce_key.is_some() || flow_value.debounce_delay_s.is_some() } { tracing::warn!( diff --git a/backend/windmill-common/src/flows.rs b/backend/windmill-common/src/flows.rs index 2f20cf613c..cc47b0b981 100644 --- a/backend/windmill-common/src/flows.rs +++ b/backend/windmill-common/src/flows.rs @@ -112,7 +112,7 @@ where let flow_value: FlowValue = serde_json::from_str(raw_value.get()) .map_err(|e| serde::de::Error::custom(format!("Invalid flow value: {}", e)))?; - FlowModule::traverse_leafs(&flow_value.modules, &mut |module| { + FlowModule::traverse_modules(&flow_value.modules, &mut |module| { if let Some(ref retry) = module.retry { validate_retry(retry, &module.id)?; } @@ -544,7 +544,7 @@ impl FlowModule { .map(|x| x.r#type) } - pub fn traverse_leafs crate::error::Result<()>>( + pub fn traverse_modules crate::error::Result<()>>( modules: &Vec, cb: &mut C, ) -> crate::error::Result<()> { @@ -556,17 +556,17 @@ impl FlowModule { { FlowModuleValue::ForloopFlow { modules, .. } | FlowModuleValue::WhileloopFlow { modules, .. } => { - Self::traverse_leafs(&modules, cb)?; + Self::traverse_modules(&modules, cb)?; } FlowModuleValue::BranchOne { branches, default, .. } => { for branch in branches { - Self::traverse_leafs(&branch.modules, cb)?; + Self::traverse_modules(&branch.modules, cb)?; } - Self::traverse_leafs(&default, cb)?; + Self::traverse_modules(&default, cb)?; } FlowModuleValue::BranchAll { branches, .. } => { for branch in branches { - Self::traverse_leafs(&branch.modules, cb)?; + Self::traverse_modules(&branch.modules, cb)?; } } FlowModuleValue::AIAgent { tools, .. } => { @@ -575,17 +575,17 @@ impl FlowModule { ToolValue::FlowModule(module_value) => match module_value { FlowModuleValue::ForloopFlow { modules, .. } | FlowModuleValue::WhileloopFlow { modules, .. } => { - Self::traverse_leafs(&modules, cb)?; + Self::traverse_modules(&modules, cb)?; } FlowModuleValue::BranchOne { branches, default, .. } => { for branch in branches { - Self::traverse_leafs(&branch.modules, cb)?; + Self::traverse_modules(&branch.modules, cb)?; } - Self::traverse_leafs(&default, cb)?; + Self::traverse_modules(&default, cb)?; } FlowModuleValue::BranchAll { branches, .. } => { for branch in branches { - Self::traverse_leafs(&branch.modules, cb)?; + Self::traverse_modules(&branch.modules, cb)?; } } _ => {}