Repository navigation
Photo routes: call the vision model off the event loop - #450
Merged
Merged
Conversation
webcam_capture, upload_image and vision_analyze are async but called the vision model with blocking requests.post, so while a picture was analysed (about 7-23 s) the dashboard answered nothing else: pages, polls and the voice socket waited. The calls now run in asyncio.to_thread. A new test scans every async handler in codec_dashboard.py and routes/ for a blocking requests call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Mickael (8 Oct): "fix the photo routes too".
routes/media.py:webcam_capture,routes/upload.py:upload_imageandroutes/vision.py:vision_analyzeareasyncbut called the vision model with blockingrequests.post(timeouts 90-120 s), so while a picture was analysed the dashboard answered nothing else. Same class as the startup warmup fixed in #446. The calls now run inasyncio.to_thread. Known issue marked fixed.Checks
tests/test_no_blocking_requests_in_async.py: AST scan of everyasync defincodec_dashboard.pyandroutes/finds no blockingrequestscall (plus a self-test that the scan catches one). Negative control on main's routes: lists exactly the three handlers.tests/test_llm_vision_dedup.pyhas 4 order-dependent failures when run right after the route tests; identical on main, passes alone and in the full suite (old leak, docs/known-issues.md 2026-09-04).Deploy
Restart
codec-dashboard.🤖 Generated with Claude Code