dimensionalOS / dimensionalOS/dimos
teleop/quest: run uvicorn on module._loop, remove WS cross-loop bridge
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.5k
- Forks
- 808
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 233
Description
Problem
QuestTeleopModule runs uvicorn in its own daemon thread (separate asyncio loop), while the camera handlers run on module._loop. Sending JPEG frames to connected WebSocket clients therefore goes through a thread bridge: a _ws_loop reference captured inside the /ws handler, used by a module-level _push_jpeg helper via asyncio.run_coroutine_threadsafe. This works but is convoluted
Refactor req
Move uvicorn onto module._loop so the WebSocket and handle_color_image execute on the same loop, then the push becomes a direct await ws.send_bytes(jpeg)
Synced from DIM-969 by summer
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating QuestTeleopModule and its module._loop, then inspect the /ws handler, _ws_loop reference, _push_jpeg helper, and handle_color_image. The refactor is done when uvicorn runs on module._loop, WebSocket handling and image processing share that loop, and JPEG delivery uses a direct await ws.send_bytes(jpeg).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100