-
Notifications
You must be signed in to change notification settings - Fork 425
Open
Description
Description
If you do not close real_response.stream then httpcore does not detect that the connection is free for reuse, and eventually you run out of available connections.
Detail
vcrpy/vcr/stubs/httpcore_stubs.py
Lines 135 to 137 in 9b58663
| # Reading the response stream consumes the iterator, so we need to restore it afterwards | |
| real_response_content = b"".join([part async for part in real_response.stream]) | |
| real_response.stream = ByteStream(real_response_content) |
The above code reads from the stream, but never calls aclose which is responsible for releasing the connection back to the pool for reuse.
The httpx library would normally take care of that for us, because it naturally closes responses after they're completely read. However, because we're replacing the async stream with a ByteStream here, that original aclose is never called.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels