FastAPI/Starlette 长连接感知断开

Est at 
之前写过如何 在服务器重启的时候感知长连接,最近发现折腾复杂了。https://github.com/encode/starlette/discussions/1776 测试代码: import asyncioasync def async_streamer(): try: while True: yield b"--boundary\r\nContent-Type: text/plain\r\nContent-Length: 1\r\n\r\n1\r\n" await asyncio.sleep(0) except asy……