Fetch the result of a job more than once if needed
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
@@ -386,12 +386,9 @@ async fn deliver_one(
|
||||
|
||||
// Stop on terminal states
|
||||
if matches!(s, TransportStatus::Delivered | TransportStatus::Read) {
|
||||
// Only request a single job status/result per message
|
||||
if !requested_job_check {
|
||||
if let Some(job_id) = job_id_opt {
|
||||
// First consult Redis for the latest job state in case we already have a terminal update
|
||||
match service_poll.load_job(context_id, caller_id, job_id).await
|
||||
{
|
||||
match service_poll.load_job(context_id, caller_id, job_id).await {
|
||||
Ok(job) => {
|
||||
match job.status() {
|
||||
JobStatus::Finished | JobStatus::Error => {
|
||||
@@ -499,7 +496,9 @@ async fn deliver_one(
|
||||
} else if let Some(s) =
|
||||
res.and_then(|v| v.as_str())
|
||||
{
|
||||
let mut patch = std::collections::HashMap::new();
|
||||
let mut patch =
|
||||
std::collections::HashMap::new(
|
||||
);
|
||||
patch.insert(
|
||||
"success".to_string(),
|
||||
s.to_string(),
|
||||
@@ -578,16 +577,12 @@ async fn deliver_one(
|
||||
secret_for_poller.clone(),
|
||||
)
|
||||
.await;
|
||||
match sup
|
||||
.job_status_wait(job_id.to_string())
|
||||
.await
|
||||
match sup.job_status_wait(job_id.to_string()).await
|
||||
{
|
||||
Ok((_out_id, reply_status)) => {
|
||||
// Interpret status reply synchronously
|
||||
let result_opt =
|
||||
reply_status.get("result");
|
||||
let error_opt =
|
||||
reply_status.get("error");
|
||||
let result_opt = reply_status.get("result");
|
||||
let error_opt = reply_status.get("error");
|
||||
if let Some(err_obj) = error_opt {
|
||||
let _ = service_poll
|
||||
.update_job_status_unchecked(
|
||||
@@ -614,10 +609,7 @@ async fn deliver_one(
|
||||
if let Some(remote_status) =
|
||||
status_candidate
|
||||
{
|
||||
if let Some((
|
||||
mapped,
|
||||
terminal,
|
||||
)) =
|
||||
if let Some((mapped, terminal)) =
|
||||
map_supervisor_job_status(
|
||||
remote_status,
|
||||
)
|
||||
@@ -692,7 +684,10 @@ async fn deliver_one(
|
||||
context_id,
|
||||
caller_id,
|
||||
id,
|
||||
vec![format!("job.status request error: {}", e)],
|
||||
vec![format!(
|
||||
"job.status request error: {}",
|
||||
e
|
||||
)],
|
||||
)
|
||||
.await;
|
||||
}
|
||||
@@ -743,7 +738,6 @@ async fn deliver_one(
|
||||
// Ensure we only do this once
|
||||
requested_job_check = true;
|
||||
}
|
||||
}
|
||||
// break;
|
||||
}
|
||||
if matches!(s, TransportStatus::Failed) {
|
||||
|
Reference in New Issue
Block a user