fix(pr_v2): close httpx client in all 5 remaining PR endpoints#582
fix(pr_v2): close httpx client in all 5 remaining PR endpoints#582
Conversation
Apply the try/finally client lifecycle pattern already established in get_pr_status to list_pull_requests, get_pull_request, create_pull_request, merge_pull_request, and close_pull_request. Prevents fd/socket leaks under load by guaranteeing await client.close() on all code paths. Closes #581
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe PR applies a consistent client cleanup pattern across 5 PR endpoints in the router. Each endpoint now initializes the GitHub AsyncClient outside the try block and guarantees closure via a finally clause, preventing file descriptor leaks under load. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📋 Issue PlannerBuilt with CodeRabbit's Coding Plans for faster development and fewer bugs. View plan used: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
ReviewLGTM — clean, focused fix. The pattern is applied consistently and correctly across all five endpoints. Moving One minor noteIf finally:
try:
await client.close()
except Exception:
logger.debug("Error closing GitHub client", exc_info=True)That said, this is the same pattern as Checklist
|
Summary
try/finally: await client.close()pattern (already established inget_pr_status) to the five endpoints that were leakinghttpx.AsyncClientconnectionslist_pull_requests,get_pull_request,create_pull_request,merge_pull_request,close_pull_requestTest plan
uv run pytest tests/ui/)ruff checkcleanget_pr_statusexactlyCloses #581
Summary by CodeRabbit