[AZ-180] Refactor detection event handling and improve SSE support

- Updated the detection image endpoint to require a channel ID for event streaming.
- Introduced a new endpoint for streaming detection events, allowing clients to receive real-time updates.
- Enhanced the internal buffering mechanism for detection events to manage multiple channels.
- Refactored the inference module to support the new event handling structure.

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-04-03 02:42:05 +03:00
parent 2c35e59a77
commit 8baa96978b
26 changed files with 819 additions and 413 deletions
+6 -18
View File
@@ -8,28 +8,16 @@ import pytest
@pytest.mark.slow
@pytest.mark.timeout(120)
def test_nft_res_lim_03_max_detections_per_frame(
warm_engine, http_client, image_dense, auth_headers
warm_engine, image_detect, image_dense
):
r = http_client.post(
"/detect/image",
files={"file": ("img.jpg", image_dense, "image/jpeg")},
headers=auth_headers,
timeout=120,
)
assert r.status_code == 200
body = r.json()
assert isinstance(body, list)
assert len(body) <= 300
detections, _ = image_detect(image_dense, "img.jpg", timeout=120)
assert isinstance(detections, list)
assert len(detections) <= 300
@pytest.mark.slow
def test_nft_res_lim_04_log_file_rotation(warm_engine, http_client, image_small, auth_headers):
http_client.post(
"/detect/image",
files={"file": ("img.jpg", image_small, "image/jpeg")},
headers=auth_headers,
timeout=60,
)
def test_nft_res_lim_04_log_file_rotation(warm_engine, image_detect, image_small):
image_detect(image_small, "img.jpg", timeout=60)
candidates = [
Path(__file__).resolve().parent.parent / "logs",
Path("/app/Logs"),