From bae8712f3b89b2cdc81551280d28468bc4bda37d Mon Sep 17 00:00:00 2001 From: Valmo Date: Tue, 30 Jun 2026 17:44:16 -0300 Subject: [PATCH] added handler that is going to jump pathes if the returned status is 5xx or 404 --- src/redis_rtsp.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/redis_rtsp.rs b/src/redis_rtsp.rs index 71e3778..304147a 100644 --- a/src/redis_rtsp.rs +++ b/src/redis_rtsp.rs @@ -119,6 +119,7 @@ pub async fn run_redis_worker( let checked_at = timestamp_millis(); let probe = probe_rtsp(&attempt, config.capture_timeout_ms).await; + let stop_path_after_attempt = probe.is_dead_path(); let (status, screenshot_path, error, attempt_captured) = if probe .is_connectable() { @@ -177,6 +178,10 @@ pub async fn run_redis_worker( path_captured = true; break; } + + if stop_path_after_attempt { + break; + } } if path_captured { @@ -367,6 +372,13 @@ impl RtspProbe { "ok" | "auth_required" | "rtsp_200" | "rtsp_401" | "rtsp_403" ) } + + fn is_dead_path(&self) -> bool { + matches!( + self.status.as_str(), + "rtsp_400" | "rtsp_404" | "rtsp_451" | "bad_response" + ) + } } fn parse_rtsp_status(response: &[u8]) -> Result> {