From 5ccc502a94215cb0d80c442e78a5ba7374f5cc51 Mon Sep 17 00:00:00 2001 From: Roman Meshko Date: Fri, 8 May 2026 18:22:58 +0300 Subject: [PATCH] Fixed prevent smoke builds and keep SSE streams alive --- .woodpecker/02-build-push.yml | 5 +++-- e2e/tests/test_performance.py | 4 ++-- src/main.py | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.woodpecker/02-build-push.yml b/.woodpecker/02-build-push.yml index 0c20c67..110b614 100644 --- a/.woodpecker/02-build-push.yml +++ b/.woodpecker/02-build-push.yml @@ -4,8 +4,9 @@ # here so builds are gated on a green test run. when: - event: [push, manual] - branch: [dev, stage, main] + - event: [push, manual] + branch: [dev, stage, main] + evaluate: 'E2E_CONVERT_JETSON != "1" && E2E_SMOKE_TEST != "1"' # Multi-arch matrix. detections is the only repo today with split per-arch # Dockerfiles (Jetson uses Dockerfile.jetson with TensorRT/CUDA on L4T; diff --git a/e2e/tests/test_performance.py b/e2e/tests/test_performance.py index 84eb22a..89e456f 100644 --- a/e2e/tests/test_performance.py +++ b/e2e/tests/test_performance.py @@ -17,7 +17,7 @@ def _percentile_ms(sorted_ms, p): return sorted_ms[lo] * (1 - w) + sorted_ms[hi] * w -@pytest.mark.timeout(60) +@pytest.mark.timeout(240) def test_nft_perf_01_single_image_latency_p95( warm_engine, image_detect, image_small ): @@ -39,7 +39,7 @@ def test_nft_perf_01_single_image_latency_p95( assert p95 < threshold_ms -@pytest.mark.timeout(60) +@pytest.mark.timeout(120) def test_nft_perf_03_tiling_overhead_large_image( warm_engine, image_detect, image_small, image_large ): diff --git a/src/main.py b/src/main.py index c9a8d51..f8470a5 100644 --- a/src/main.py +++ b/src/main.py @@ -415,8 +415,11 @@ async def detect_events(channel_id: str, request: Request, after_ts: Optional[in if ts_ms > after_ts: yield f"id: {ts_ms}\ndata: {data}\n\n" while True: - ts_ms, data = await queue.get() - yield f"id: {ts_ms}\ndata: {data}\n\n" + try: + ts_ms, data = await asyncio.wait_for(queue.get(), timeout=1.0) + yield f"id: {ts_ms}\ndata: {data}\n\n" + except asyncio.TimeoutError: + yield ": heartbeat\n\n" except asyncio.CancelledError: pass finally: