This is continuation of the discussion from #286 (comment)
Hello! I experience an issue when running Litestar with Granian that I do not have when use Uvicorn. In the previous discussion I don't think I've provided a sufficient illustration.
Here’s a new one:
import asyncio
import math
import typing
import litestar
from litestar.response import ServerSentEvent
async def iter_sse_data() -> typing.AsyncIterable[str]:
yield "hi"
try:
print("about to sleep indefinitely")
await asyncio.sleep(math.inf)
finally:
print("cleaned up")
@litestar.get("/")
async def root() -> ServerSentEvent:
return ServerSentEvent(iter_sse_data())
app = litestar.Litestar([root])
curl http://localhost:8000/
, wait for data: hi
and press Ctrl+C
.cleaned up
.Run the app with Uvicorn—and you’ll see that cleaned up
was printed.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too