fix: scope AsyncFastAPI HTTP client pool to instance instead of class#6882
fix: scope AsyncFastAPI HTTP client pool to instance instead of class#6882YizukiAme wants to merge 1 commit intochroma-core:mainfrom
Conversation
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
|
Fix This PR fixes a bug where A focused test is added to verify isolation between two This summary was automatically generated by @propel-code-bot |
Fixes #6869
Problem
AsyncFastAPI._clientsis declared as a class variable, so all instances share the sameDict[int, httpx.AsyncClient]pool. When multipleAsyncFastAPIinstances are created (e.g. in tests or multi-tenant setups), they cross-contaminate each other's HTTP transports. Closing one instance's client can corrupt another instance's connection pool.Fix
Move
_clientsinitialization from class-level to__init__, making it an instance variable:Tests
53-line test verifying that two
AsyncFastAPIinstances maintain independent client pools and that cleanup of one does not affect the other.This fix was developed with AI assistance and reviewed by a human.