handle timeouted h2 connections, refill reply budget

This commit is contained in:
Flowseal committed 2026-10-10 21:36:28 +03:00
1 parent 59c3a6e3b3
commit 3cda0f5446
4 files changed
+95 -4

No files matched your search

+8 -1
View File
@@ -49,7 +49,14 @@ class _ResponseStream(httpx.AsyncByteStream):
try:
await asyncio.wait_for(self.changed.wait(), self.read_timeout)
except asyncio.TimeoutError as exc:
raise httpx.ReadTimeout('Timed out waiting for H2 stream %d' % self.stream_id) from exc
error = httpx.ReadTimeout('Timed out waiting for H2 stream %d' % self.stream_id)
# An idle socket can remain established after the path stops
# delivering data. Reconnect once its last active request times
# out, while preserving unrelated requests and buffered replies.
if not any(stream is not self and not stream.ended
for stream in self.connection.streams.values()):
self.connection.fail(error)
raise error from exc
def check_error(self):
if self.error is not None: