mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-18 04:44:37 +00:00
docs(proxy): say why the streaming loop yields on every chunk
This commit is contained in:
parent
09242962e5
commit
f76ae0de9a
1 changed files with 2 additions and 0 deletions
|
|
@ -10288,6 +10288,8 @@ async def async_data_generator(
|
|||
)
|
||||
|
||||
async for item in stream_source:
|
||||
# Unblock the event loop: a stream whose chunks are already buffered never awaits
|
||||
# between chunks, so without this yield one long stream holds the loop for its whole body
|
||||
await asyncio.sleep(0)
|
||||
if item is _STREAM_KEEPALIVE:
|
||||
yield ": ping\n\n"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue