[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
+5 -1
View File
@@ -1,3 +1,5 @@
import uuid
import pytest
import requests
@@ -41,6 +43,8 @@ def test_ft_n_03_loader_error_mode_detect_does_not_500(
f"{mock_loader_url}/mock/config", json={"mode": "error"}, timeout=10
)
cfg.raise_for_status()
channel_id = str(uuid.uuid4())
headers = {**auth_headers, "X-Channel-Id": channel_id}
files = {"file": ("small.jpg", image_small, "image/jpeg")}
r = http_client.post("/detect/image", files=files, headers=auth_headers, timeout=_DETECT_TIMEOUT)
r = http_client.post("/detect/image", files=files, headers=headers, timeout=_DETECT_TIMEOUT)
assert r.status_code != 500