Skip to content

Commit

Permalink
fix(backend): fix has_failure_module only looking for raw_flow (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
uael authored Jan 6, 2025
1 parent 3eaef46 commit abf63a6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions backend/windmill-queue/src/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,11 +900,14 @@ pub async fn add_completed_job<T: Serialize + Send + Sync + ValidableJson>(

#[cfg(feature = "enterprise")]
if !success {
async fn has_failure_module(db: &Pool<Postgres>, job_id: Uuid) -> bool {
sqlx::query_scalar!("SELECT raw_flow->'failure_module' != 'null'::jsonb FROM job WHERE id = $1", job_id)
async fn has_failure_module(db: &Pool<Postgres>, job: &QueuedJob) -> bool {
if let Ok(flow) = cache::job::fetch_flow(db, job.job_kind, job.script_hash).await {
return flow.value().failure_module.is_some();
}
sqlx::query_scalar!("SELECT raw_flow->'failure_module' != 'null'::jsonb FROM job WHERE id = $1", job.id)
.fetch_one(db)
.or_else(|_|
sqlx::query_scalar!("SELECT raw_flow->'failure_module' != 'null'::jsonb FROM completed_job WHERE id = $1", job_id)
sqlx::query_scalar!("SELECT raw_flow->'failure_module' != 'null'::jsonb FROM completed_job WHERE id = $1", job.id)
.fetch_one(db)
)
.await
Expand Down Expand Up @@ -952,7 +955,7 @@ pub async fn add_completed_job<T: Serialize + Send + Sync + ValidableJson>(
} else if !_skip_downstream_error_handlers
&& (matches!(queued_job.job_kind, JobKind::Script)
|| matches!(queued_job.job_kind, JobKind::Flow)
&& !has_failure_module(db, _job_id).await)
&& !has_failure_module(db, queued_job).await)
&& queued_job.parent_job.is_none()
{
let result = serde_json::from_str(
Expand Down

0 comments on commit abf63a6

Please sign in to comment.