MCPcopy
hub / github.com/fastapi/fastapi / _sse_with_checkpoints

Function _sse_with_checkpoints

fastapi/routing.py:613–621  ·  view source on GitHub ↗
(
                    stream: ObjectReceiveStream[bytes],
                )

Source from the content-addressed store, hash-verified

611 async_exit_stack.push_async_callback(sse_receive_stream.aclose)
612
613 async def _sse_with_checkpoints(
614 stream: ObjectReceiveStream[bytes],
615 ) -> AsyncIterator[bytes]:
616 async for data in stream:
617 yield data
618 # Guarantee a checkpoint so cancellation can be
619 # delivered even when the producer is faster than
620 # the consumer and receive() never suspends.
621 await anyio.sleep(0)
622
623 sse_stream_content: AsyncIterator[bytes] | Iterator[bytes] = (
624 _sse_with_checkpoints(sse_receive_stream)

Callers 1

appFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…