fix: move timeout definition before cert check
This commit is contained in:
parent
81ac8f0c20
commit
b41faff2ad
|
|
@ -66,6 +66,10 @@ async fn run_check(client: &reqwest::Client, monitor: &Monitor, scheduled_at: Op
|
|||
|
||||
let start = Instant::now();
|
||||
|
||||
// Build request with method, headers, body, timeout
|
||||
let method = monitor.method.as_deref().unwrap_or("GET").to_uppercase();
|
||||
let timeout = std::time::Duration::from_millis(monitor.timeout_ms.unwrap_or(30000));
|
||||
|
||||
// Check cert expiry for HTTPS URLs — bounded by the same timeout
|
||||
let cert_expiry_days = if monitor.url.starts_with("https://") {
|
||||
match tokio::time::timeout(timeout, check_cert_expiry(&monitor.url)).await {
|
||||
|
|
@ -76,10 +80,6 @@ async fn run_check(client: &reqwest::Client, monitor: &Monitor, scheduled_at: Op
|
|||
None
|
||||
};
|
||||
|
||||
// Build request with method, headers, body, timeout
|
||||
let method = monitor.method.as_deref().unwrap_or("GET").to_uppercase();
|
||||
let timeout = std::time::Duration::from_millis(monitor.timeout_ms.unwrap_or(30000));
|
||||
|
||||
let req_method = reqwest::Method::from_bytes(method.as_bytes())
|
||||
.unwrap_or(reqwest::Method::GET);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue