error for flow of length 0

This commit is contained in:
Ruben Fiszel
2022-07-31 19:15:05 +02:00
parent 2483072d81
commit abcd25dbff
2 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -1011,7 +1011,7 @@ pub async fn restart_zombie_jobs_periodically(
loop {
let restarted = sqlx::query!(
"UPDATE queue SET running = false WHERE last_ping < $1 and running = true RETURNING id, workspace_id",
chrono::Utc::now() - chrono::Duration::seconds(timeout as i64 * 2)
chrono::Utc::now() - chrono::Duration::seconds(timeout as i64 * 5)
)
.fetch_all(db)
.await
@@ -1019,7 +1019,7 @@ pub async fn restart_zombie_jobs_periodically(
.unwrap_or_else(|| vec![]);
for r in restarted {
tracing::info!("restarted zombie jobs {} {}", r.id, r.workspace_id);
tracing::info!("restarted zombie job {} {}", r.id, r.workspace_id);
}
tokio::select! {
+7
View File
@@ -365,6 +365,13 @@ pub async fn handle_flow(
.ok_or_else(|| Error::InternalErr(format!("requiring a raw flow value")))?
.to_owned();
let flow = serde_json::from_value::<FlowValue>(value.to_owned())?;
if flow.modules.len() == 0 {
Err(Error::BadRequest(format!(
"A flow needs at least one module to run"
)))?;
}
push_next_flow_job(
flow_job,
flow,