From 98b65ed2318faa5d593fbeeba8c549fef06985fd Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 2 May 2024 10:06:16 +0200 Subject: [PATCH] box flowmodule to reduce stack allocation of flowvalue --- backend/windmill-api/src/flows.rs | 4 ++-- backend/windmill-common/src/flows.rs | 2 +- backend/windmill-worker/src/worker_flow.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/windmill-api/src/flows.rs b/backend/windmill-api/src/flows.rs index 05f732358c..cc0980e4a3 100644 --- a/backend/windmill-api/src/flows.rs +++ b/backend/windmill-api/src/flows.rs @@ -955,7 +955,7 @@ mod tests { continue_on_error: None, }, ], - failure_module: Some(FlowModule { + failure_module: Some(Box::new(FlowModule { id: "d".to_string(), value: FlowModuleValue::Script { path: "test".to_string(), @@ -977,7 +977,7 @@ mod tests { priority: None, delete_after_use: None, continue_on_error: None, - }), + })), same_worker: false, concurrent_limit: None, concurrency_time_window_s: None, diff --git a/backend/windmill-common/src/flows.rs b/backend/windmill-common/src/flows.rs index ff4d023d7d..852ea7e442 100644 --- a/backend/windmill-common/src/flows.rs +++ b/backend/windmill-common/src/flows.rs @@ -87,7 +87,7 @@ pub struct FlowValue { pub modules: Vec, #[serde(skip_serializing_if = "Option::is_none")] #[serde(default)] - pub failure_module: Option, + pub failure_module: Option>, #[serde(default)] #[serde(skip_serializing_if = "is_default")] pub same_worker: bool, diff --git a/backend/windmill-worker/src/worker_flow.rs b/backend/windmill-worker/src/worker_flow.rs index 4a939e4da2..bcbed40a39 100644 --- a/backend/windmill-worker/src/worker_flow.rs +++ b/backend/windmill-worker/src/worker_flow.rs @@ -931,7 +931,7 @@ fn get_module(flow_job: &QueuedJob, module_index: Option) -> Option let mut module: &FlowModule = flow .modules .get(i) - .or_else(|| flow.failure_module.as_ref()) + .or_else(|| flow.failure_module.as_deref()) .with_context(|| format!("no module at index {}", status.step))?; let current_id = &module.id;