From 9f9796ddb6b20285bf3191417651b3e89c453e36 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 12 Apr 2026 21:27:25 -0500 Subject: [PATCH] =?UTF-8?q?Reduce=20DoA=20poll=20rate=20(10=E2=86=925Hz)?= =?UTF-8?q?=20and=20gaze=20push=20rate=20(10=E2=86=922/sec)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 10Hz DoA polling + 10Hz gaze HTTP pushes was creating too much GIL pressure, starving uvicorn's async event loop. Reduced to 5Hz polling and max 2 gaze pushes/sec with 5px min delta. Co-Authored-By: Claude Opus 4.6 (1M context) --- headmic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/headmic.py b/headmic.py index 79df6c7..ddda680 100644 --- a/headmic.py +++ b/headmic.py @@ -67,7 +67,7 @@ MAX_RECORDING_FRAMES = 1000 # ~30 sec max EARTAIL_URL = os.environ.get("EARTAIL_URL", "http://bigorin.local:8764") -DOA_POLL_HZ = 10 # DoA polling rate +DOA_POLL_HZ = 5 # DoA polling rate (lower = less GIL pressure on uvicorn) EYE_SERVICE_URL = os.environ.get("EYE_SERVICE_URL", "http://localhost:8780") # ============================================================================ @@ -425,8 +425,8 @@ from spatial import SpatialTracker spatial_tracker: Optional[SpatialTracker] = None GAZE_CENTER = 127 _last_gaze_push: tuple[int, int] = (GAZE_CENTER, GAZE_CENTER) -GAZE_PUSH_MIN_DELTA = 3 # don't push gaze unless it moved by at least this much -GAZE_PUSH_INTERVAL = 0.1 # max 10 gaze pushes/sec to eye service +GAZE_PUSH_MIN_DELTA = 5 # don't push gaze unless it moved by at least this much +GAZE_PUSH_INTERVAL = 0.5 # max 2 gaze pushes/sec to eye service def doa_track_loop():