mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
## Summary Parallelize independent DB writes at the end of 4 endpoints using `asyncio.TaskGroup`. With psycopg3 connection pooling (#2489), each task gets its own connection from the pool. ### Endpoints optimized | Endpoint | Before | After | |----------|--------|-------| | **Refinement** | `log_features` then `update_optimization_cost` | `TaskGroup` (concurrent) | | **Explanations** | `update_optimization_cost` inside inner fn | Moved to handler, `TaskGroup` with `log_features` | | **Optimization review** | `update_optimization_cost` inside inner fn | Moved to handler, `TaskGroup` with `update_optimization_features_review` | | **Ranker** | `update_optimization_cost` inside inner fn | Moved to handler, `TaskGroup` with `log_features` | Each endpoint saves ~87ms (one DB round-trip) by overlapping two independent writes. ### Comprehensive audit All 13 endpoints were audited — no remaining async antipatterns found: - No blocking calls in async paths - No `await`-in-loop patterns - LLM clients already use connection reuse - All other endpoints have at most 1 DB write in the epilogue ## Test plan - [x] All 538 tests passing - [ ] Verify under load in staging --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com> Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| workflows | ||
| dependabot.yml | ||
| pull_request_template.md | ||