From b41faff2adf3d7cda557f6c9dd85e751d1c3009a Mon Sep 17 00:00:00 2001 From: M1 Date: Wed, 18 Mar 2026 12:27:00 +0400 Subject: [PATCH] fix: move timeout definition before cert check --- apps/monitor/src/runner.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/monitor/src/runner.rs b/apps/monitor/src/runner.rs index c71b505..bac76ad 100644 --- a/apps/monitor/src/runner.rs +++ b/apps/monitor/src/runner.rs @@ -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);