added handler that is going to jump pathes if the returned status is 5xx or 404

This commit is contained in:
2026-06-30 17:44:16 -03:00
parent fc3b2ef309
commit bae8712f3b
+12
View File
@@ -119,6 +119,7 @@ pub async fn run_redis_worker(
let checked_at = timestamp_millis(); let checked_at = timestamp_millis();
let probe = probe_rtsp(&attempt, config.capture_timeout_ms).await; 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 let (status, screenshot_path, error, attempt_captured) = if probe
.is_connectable() .is_connectable()
{ {
@@ -177,6 +178,10 @@ pub async fn run_redis_worker(
path_captured = true; path_captured = true;
break; break;
} }
if stop_path_after_attempt {
break;
}
} }
if path_captured { if path_captured {
@@ -367,6 +372,13 @@ impl RtspProbe {
"ok" | "auth_required" | "rtsp_200" | "rtsp_401" | "rtsp_403" "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<Option<u16>> { fn parse_rtsp_status(response: &[u8]) -> Result<Option<u16>> {