Skip to content

Commit

Permalink
fix(backend): return flow result if flow fails or stops before early …
Browse files Browse the repository at this point in the history
…return (#3704)

* fix: return error if flow fails before early return

* fix: also handle early stop

* fix: improve code
  • Loading branch information
HugoCasa committed May 10, 2024
1 parent bb8af8f commit 67f4a4a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/windmill-api/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2528,7 +2528,7 @@ async fn run_wait_result(
w_id: String,
node_id_for_empty_return: Option<String>,
) -> error::Result<Response> {
let mut result;
let mut result = None;
let timeout = SERVER_CONFIG.read().await.timeout_wait_result.clone();
let timeout_ms = if timeout <= 0 {
2000
Expand All @@ -2552,7 +2552,9 @@ async fn run_wait_result(
)
.await
.ok();
} else {
}

if result.is_none() {
let row = sqlx::query(
"SELECT result, language, flow_status FROM completed_job WHERE id = $1 AND workspace_id = $2",
)
Expand All @@ -2570,8 +2572,6 @@ async fn run_wait_result(
FormattedResult::RawValue(rv) => rv,
FormattedResult::Vec(v) => Some(to_raw_value(&v)),
};
} else {
result = None;
}
}

Expand Down

0 comments on commit 67f4a4a

Please sign in to comment.