diff --git a/headmic.py b/headmic.py index 08fe9b4..950b958 100644 --- a/headmic.py +++ b/headmic.py @@ -464,13 +464,16 @@ def doa_track_loop(): def _push_gaze(x: int, y: int): - """Fire-and-forget gaze push to eye service.""" + """Fire-and-forget gaze push to eye service. Uses urllib to avoid httpx connection overhead.""" try: - import httpx - httpx.post(f"{EYE_SERVICE_URL}/gaze", - json={"x": x, "y": y}, timeout=0.5) + import urllib.request + data = json.dumps({"x": x, "y": y}).encode() + req = urllib.request.Request( + f"{EYE_SERVICE_URL}/gaze", data=data, + headers={"Content-Type": "application/json"}) + urllib.request.urlopen(req, timeout=0.3) except Exception: - pass # eye service may be down, don't spam logs + pass # ============================================================================