fix: fix retry not working on single step flow due to opt

This commit is contained in:
Ruben Fiszel
2024-05-28 10:48:41 +02:00
parent e5db421b1b
commit 6166c4d7aa
+17 -5
View File
@@ -536,7 +536,9 @@ pub async fn update_flow_status_after_job_completion_internal<
.fetch_optional(&mut tx)
.await
.map_err(|e| {
Error::InternalErr(format!("error while getting retry from step: {e:#}"))
Error::InternalErr(format!(
"error while getting retry from step: {e:#}"
))
})?
.flatten();
@@ -986,7 +988,11 @@ async fn compute_skip_branchall_failure<'c>(
.fetch_one(db)
.await
.map(|(v,)| v)
.map_err(|e| Error::InternalErr(format!("error during retrieval of skip_loop_failures: {e:#}")))
.map_err(|e| {
Error::InternalErr(format!(
"error during retrieval of skip_loop_failures: {e:#}"
))
})
}
async fn has_failure_module<'c>(
@@ -1001,7 +1007,11 @@ async fn has_failure_module<'c>(
.bind(flow)
.fetch_one(&mut **tx)
.await
.map_err(|e| Error::InternalErr(format!("error during retrieval of has_failure_module: {e:#}")))
.map_err(|e| {
Error::InternalErr(format!(
"error during retrieval of has_failure_module: {e:#}"
))
})
.map(|v| v.unwrap_or(false))
}
@@ -2151,8 +2161,9 @@ async fn push_next_flow_job<R: rsmq_async::RsmqConnection + Send + Sync + Clone>
}
if payload_tag.delete_after_use {
let uuid_singleton_json = serde_json::to_value(&[uuid])
.map_err(|e| error::Error::InternalErr(format!("Unable to serialize uuid: {e:#}")))?;
let uuid_singleton_json = serde_json::to_value(&[uuid]).map_err(|e| {
error::Error::InternalErr(format!("Unable to serialize uuid: {e:#}"))
})?;
sqlx::query(
"UPDATE queue
@@ -2950,6 +2961,7 @@ fn is_simple_modules(modules: &Vec<FlowModule>, flow: &FlowValue) -> bool {
&& modules[0].sleep.is_none()
&& modules[0].suspend.is_none()
&& modules[0].cache_ttl.is_none()
&& modules[0].retry.is_none()
&& modules[0].stop_after_if.is_none()
&& (modules[0].mock.is_none() || modules[0].mock.as_ref().is_some_and(|m| !m.enabled))
&& flow.failure_module.is_none();