Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

as clippy wanted #8

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading