Skip to content

Commit b001ffd

Browse files
committed
Merge #608: Add timeout to http_health_check binary
3e2b152 feat: [#604] add timeout to http_health_check binary (Jose Celano) Pull request description: Add timeout to `http_health_check` binary. ACKs for top commit: josecelano: ACK 3e2b152 Tree-SHA512: e0a49c32f0cd8888ae3229f4c43e2cca307e9d7fb99a3336c4d6a5f3a4068accabce0497378bbfd66e8dc3ee4db95fd1a0c52b1aff3bafacd0548f6e6daba3f5
2 parents 1d9d4f3 + 3e2b152 commit b001ffd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/http_health_check.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
//!
55
//! - They are harder to maintain.
66
//! - They introduce new attack vectors.
7+
use std::time::Duration;
78
use std::{env, process};
89

10+
use reqwest::Client;
11+
912
#[tokio::main]
1013
async fn main() {
1114
let args: Vec<String> = env::args().collect();
@@ -19,7 +22,9 @@ async fn main() {
1922

2023
let url = &args[1].clone();
2124

22-
match reqwest::get(url).await {
25+
let client = Client::builder().timeout(Duration::from_secs(5)).build().unwrap();
26+
27+
match client.get(url).send().await {
2328
Ok(response) => {
2429
if response.status().is_success() {
2530
println!("STATUS: {}", response.status());

0 commit comments

Comments
 (0)