Skip to content

Commit 08d4749

Browse files
committed
fix send timeout messages
1 parent 2b29ded commit 08d4749

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

litestar/response/streaming.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(
5353
is_head_response: bool = False,
5454
media_type: MediaType | str | None = None,
5555
status_code: int | None = None,
56-
timeout: int | None = None,
56+
timeout: int | None = 0,
5757
) -> None:
5858
"""A low-level ASGI streaming response.
5959
@@ -127,7 +127,7 @@ async def _stream(self, send: Send) -> None:
127127
Returns:
128128
None
129129
"""
130-
if self.timeout is not None:
130+
if self.timeout:
131131
await self._stream_with_timeout_events(send)
132132
else:
133133
async for chunk in self.iterator:
@@ -165,6 +165,7 @@ async def _stream_with_timeout_events(self, send: Send) -> None:
165165
"body": b"timeout ping\n",
166166
"more_body": True,
167167
}
168+
await send(stream_event)
168169

169170
try:
170171
chunk = task.result()

0 commit comments

Comments
 (0)