mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-12-19 22:09:26 +08:00
Do not panick on healthcheck connection error (#2145)
* Handle unhappy flow Fix the healthcheck to handle not only the happy flow, but also errors like "connection refused" or "host unreachable". * Fix Typo in variable
This commit is contained in:
parent
15762fba2b
commit
058208992a
1 changed files with 20 additions and 15 deletions
|
|
@ -116,23 +116,28 @@ impl ServerCommands {
|
||||||
format!("{}/healthz/{}",
|
format!("{}/healthz/{}",
|
||||||
client.url,
|
client.url,
|
||||||
check.unwrap_or("ready".to_string()))
|
check.unwrap_or("ready".to_string()))
|
||||||
)
|
).await;
|
||||||
.await
|
match response {
|
||||||
.unwrap();
|
Ok(resp) => {
|
||||||
|
match resp.status() {
|
||||||
match response.status() {
|
|
||||||
StatusCode::OK => {
|
StatusCode::OK => {
|
||||||
eprintln!("Success")
|
eprintln!("Success")
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"Request failed: {}",
|
"Request failed: {}",
|
||||||
response.text().await.unwrap_result("fetch text")
|
resp.text().await.unwrap_result("fetch text")
|
||||||
);
|
);
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("Request failed: {}", err);
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue