Skip to content

Commit 3e2b152

Browse files
committed
feat: [#604] add timeout to http_health_check binary
1 parent 1d9d4f3 commit 3e2b152

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/http_health_check.rs

Lines changed: 6 additions & 1 deletion
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)