Skip to content

Commit

Permalink
as clippy wanted
Browse files Browse the repository at this point in the history
  • Loading branch information
enola-dkfz committed Mar 15, 2024
1 parent 60e1c3b commit 1c098a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use thiserror::Error;

#[derive(Error, Debug)]
pub enum PrismError {
#[error("Configuration error: {0}")]
ConfigurationError(String),
#[error("Parsing error: {0}")]
ParsingError(String),
#[error("Beam error: {0}")]
Expand All @@ -13,5 +11,5 @@ pub enum PrismError {
#[error("Decode error: {0}")]
DecodeError(base64::DecodeError),
#[error("Unexpected WorkStatus: {0:?}")]
UnexpectedWorkStatusError(beam_lib::WorkStatus),
UnexpectedWorkStatus(beam_lib::WorkStatus),
}
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ async fn get_results(shared_state: SharedState, task_id: MsgId, wait_count: usiz
while let Some(Ok(async_sse::Event::Message(msg))) = stream.next().await {
let (from, measure_report) = match decode_result(&msg) {
Ok(v) => v,
Err(PrismError::UnexpectedWorkStatusError(beam_lib::WorkStatus::Claimed)) => {
Err(PrismError::UnexpectedWorkStatus(beam_lib::WorkStatus::Claimed)) => {
info!("Task claimed:) {msg:?}");
continue;
}
Err(PrismError::UnexpectedWorkStatusError(
Err(PrismError::UnexpectedWorkStatus(
beam_lib::WorkStatus::PermFailed | beam_lib::WorkStatus::TempFailed,
)) => {
warn!("WorkStatus PermFailed: {msg:?}");
Expand Down Expand Up @@ -308,7 +308,7 @@ fn decode_result(msg: &async_sse::Message) -> Result<(AppId, MeasureReport), Pri
beam_lib::WorkStatus::Succeeded => {}
yep => {
// claimed not an error!!!!
return Err(PrismError::UnexpectedWorkStatusError(yep));
return Err(PrismError::UnexpectedWorkStatus(yep));
}
}
let decoded = BASE64
Expand All @@ -324,7 +324,7 @@ async fn wait_for_beam_proxy() -> beam_lib::Result<()> {
const MAX_RETRIES: u8 = 3;
let mut tries = 1;
loop {
match reqwest::get(format!("{}v1/health", CONFIG.beam_proxy_url.to_string())).await {
match reqwest::get(format!("{}v1/health", CONFIG.beam_proxy_url)).await {
//FIXME why doesn't it work with url from config
Ok(res) if res.status() == StatusCode::OK => return Ok(()),
_ if tries <= MAX_RETRIES => tries += 1,
Expand Down

0 comments on commit 1c098a9

Please sign in to comment.