Skip to content

Commit bf8137a

Browse files
authored
Merge pull request #19 from CeerDecy/fix/windows-build
fix: conditional checks are performed before the node is actually exe…
2 parents 1f4ca15 + 7ee8efc commit bf8137a

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

auto-engine-core/src/types/conditions.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ impl Conditions {
3838
&& condition != ""
3939
{
4040
let condition = utils::parse_variables(ctx, condition).await;
41+
if condition == "" {
42+
return Ok(false);
43+
}
4144
let result = evalexpr::eval_boolean(&condition)
4245
.map_err(|err| format!("{} is not boolean", err))?;
4346
if !result {

auto-engine-core/src/workflow/runner.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,6 @@ fn handle_nod(
210210
)
211211
};
212212

213-
if let Some(condition) = node_schema.metadata.conditions {
214-
if !condition.check(&ctx).await? {
215-
emitter
216-
.emit(
217-
NODE_EVENT,
218-
NodeEventPayload::skip::<String>(node_id.clone(), None),
219-
)
220-
.unwrap_or_default();
221-
continue;
222-
}
223-
}
224-
225213
let action = node_schema.action_type.clone();
226214

227215
let (node, mut runner) = {
@@ -268,6 +256,18 @@ fn handle_nod(
268256
return Ok(None);
269257
}
270258

259+
if let Some(condition) = node_schema.metadata.conditions {
260+
if !condition.check(&ctx).await? {
261+
emitter
262+
.emit(
263+
NODE_EVENT,
264+
NodeEventPayload::skip::<String>(node_id.clone(), None),
265+
)
266+
.unwrap_or_default();
267+
return Ok(None);
268+
}
269+
}
270+
271271
let mut result: Result<Option<HashMap<String, serde_json::Value>>, String> =
272272
Ok(None);
273273
if retry <= -1 {

0 commit comments

Comments
 (0)