fix: fail on non-integer sleep value (#2556)

This commit is contained in:
Tsvetomir Bonev
2023-11-04 01:49:57 +02:00
committed by GitHub
parent 0fcebe4420
commit 6f47b96006

View File

@@ -1425,7 +1425,11 @@ async fn push_next_flow_job<R: rsmq_async::RsmqConnection + Send + Sync + Clone>
};
match json_value {
Ok(serde_json::Value::Number(n)) => {
n.as_u64().map(|x| from_now(Duration::from_secs(x)))
if n.is_u64() {
n.as_u64().map(|x| from_now(Duration::from_secs(x)))
} else {
Err(Error::ExecutionErr(format!("Expected an integer, found: {n}")))
}
}
_ => Err(Error::ExecutionErr(format!(
"Expected a number value, found: {json_value:?}"