Skip to content

Commit

Permalink
consolidation
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallagher committed Jan 17, 2025
1 parent e813215 commit 14a7b11
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions gateway-sp-comms/src/single_sp/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,13 +749,23 @@ async fn determine_update_resume_point_via_update_status(
image_len: usize,
log: &Logger,
) -> Option<u32> {
let status =
// We can only recover if the SP still thinks this update is in progress.
let progress =
match super::rpc(cmds_tx, MgsRequest::UpdateStatus(component), None)
.await
.result
.and_then(expect_update_status)
{
Ok(status) => status,
Ok(UpdateStatus::InProgress(progress)) => progress,
Ok(other_status) => {
error!(
log,
"invalid update chunk recovery failed: \
SP update status is not in progress";
"status" => ?other_status,
);
return None;
}
Err(status_err) => {
error!(
log,
Expand All @@ -767,17 +777,6 @@ async fn determine_update_resume_point_via_update_status(
}
};

// We can only recover if the SP still thinks this update is in progress.
let UpdateStatus::InProgress(progress) = status else {
error!(
log,
"invalid update chunk recovery failed: \
SP update status is not in progress";
"status" => ?status,
);
return None;
};

let UpdateInProgressStatus { id, bytes_received, total_size } = progress;
let id = Uuid::from(id);

Expand Down Expand Up @@ -819,7 +818,8 @@ async fn determine_update_resume_point_via_update_status(
"invalid update chunk recovery failed: \
invalid update status from SP \
(bytes_received > total_size ?!)";
"status" => ?status,
"bytes_received" => bytes_received,
"total_size" => total_size,
);
return None;
}
Expand Down

0 comments on commit 14a7b11

Please sign in to comment.