Skip to content

Commit 98b65ed

Browse files
committed
box flowmodule to reduce stack allocation of flowvalue
1 parent b2d9f7d commit 98b65ed

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

backend/windmill-api/src/flows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ mod tests {
955955
continue_on_error: None,
956956
},
957957
],
958-
failure_module: Some(FlowModule {
958+
failure_module: Some(Box::new(FlowModule {
959959
id: "d".to_string(),
960960
value: FlowModuleValue::Script {
961961
path: "test".to_string(),
@@ -977,7 +977,7 @@ mod tests {
977977
priority: None,
978978
delete_after_use: None,
979979
continue_on_error: None,
980-
}),
980+
})),
981981
same_worker: false,
982982
concurrent_limit: None,
983983
concurrency_time_window_s: None,

backend/windmill-common/src/flows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub struct FlowValue {
8787
pub modules: Vec<FlowModule>,
8888
#[serde(skip_serializing_if = "Option::is_none")]
8989
#[serde(default)]
90-
pub failure_module: Option<FlowModule>,
90+
pub failure_module: Option<Box<FlowModule>>,
9191
#[serde(default)]
9292
#[serde(skip_serializing_if = "is_default")]
9393
pub same_worker: bool,

backend/windmill-worker/src/worker_flow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ fn get_module(flow_job: &QueuedJob, module_index: Option<usize>) -> Option<FlowM
931931
if let Some(module) = raw_flow.modules.get(i) {
932932
Some(module.clone())
933933
} else {
934-
raw_flow.failure_module
934+
raw_flow.failure_module.map(|x| *x.clone())
935935
}
936936
} else {
937937
None
@@ -1674,7 +1674,7 @@ async fn push_next_flow_job<R: rsmq_async::RsmqConnection + Send + Sync + Clone>
16741674
let mut module: &FlowModule = flow
16751675
.modules
16761676
.get(i)
1677-
.or_else(|| flow.failure_module.as_ref())
1677+
.or_else(|| flow.failure_module.as_deref())
16781678
.with_context(|| format!("no module at index {}", status.step))?;
16791679

16801680
let current_id = &module.id;

0 commit comments

Comments
 (0)