fix: move timeout definition before cert check

This commit is contained in:
M1 2026-03-18 12:27:00 +04:00
parent 81ac8f0c20
commit b41faff2ad
1 changed files with 4 additions and 4 deletions

View File

@ -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);