Skip to content

Commit

Permalink
cmk-agent-ctl: Remove unwrap from connection_timeout
Browse files Browse the repository at this point in the history
CMK-19040

Change-Id: I53ab9514f644e8d5cf2bf94d2f0299af4bf966c1
  • Loading branch information
Owen Synge committed Feb 12, 2025
1 parent 3a28763 commit f4cf500
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/host/cmk-agent-ctl/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ impl PathResolver {
}

pub fn connection_timeout() -> u64 {
match env::var(constants::ENV_CONNECTION_TIMEOUT) {
Err(_) => constants::CONNECTION_TIMEOUT,
Ok(timeout) => {
let max = timeout.parse().unwrap();
debug!("Using debug value for CONNECTION_TIMEOUT: {}", max);
max
}
}
let Ok(str_timeout) = env::var(constants::ENV_CONNECTION_TIMEOUT) else {
return constants::CONNECTION_TIMEOUT;
};
let Ok(timeout) = str_timeout.parse() else {
debug!("Failed conversion of '{}' to u64.", str_timeout);
return constants::CONNECTION_TIMEOUT;
};
debug!("Using debug value for CONNECTION_TIMEOUT: {}", timeout);
timeout
}

pub fn max_connections() -> usize {
Expand Down

0 comments on commit f4cf500

Please sign in to comment.