Reduce DoA poll rate (10→5Hz) and gaze push rate (10→2/sec)

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) <noreply@anthropic.com>
This commit is contained in:
Alex
2026-04-12 21:27:25 -05:00
parent 2bbbb6da2b
commit 9f9796ddb6

View File

@@ -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():