Skip to content

Commit 8ff0bbb

Browse files
Handle write timeout when flushing write buffer
1 parent 5543ec1 commit 8ff0bbb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

httpx/concurrency/trio.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ async def write(
7878
# Reset before recursive call, otherwise we'll go through
7979
# this branch indefinitely.
8080
self.write_buffer = b""
81-
await self.write(previous_data, timeout=timeout, flag=flag)
81+
try:
82+
await self.write(previous_data, timeout=timeout, flag=flag)
83+
except WriteTimeout:
84+
self.writer_buffer = previous_data
85+
raise
8286

8387
if not data:
8488
return

0 commit comments

Comments
 (0)