You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this belongs here or in Hypercorn.
If I create 6 SSE connections to the server, it seems to stall, and no more can be created, and it seems no requests or any kind get through. They only get through when the SSEs time out.
(Maybe relatedly, I noticed that Hypercorn doesn't want to be killed via CTRL-C when there are active SSEs.)
To reproduce, put the following code into a file called sse_test.py and run it.
from quart import Quart, make_response
from asyncio import sleep
app = Quart(__name__)
@app.get("/")
async def index():
return """
<script>
for (let i = 1000; i < 1010; i++){
let sse = new EventSource("/stream/" + i);
sse.addEventListener('sse_test', (e) => {console.log(e.data)});
}
</script>
"""
async def send_events(channel):
i = 0
while True:
ret = f"{channel}:{i}"
yield f'data: {ret}\nevent: sse_test\r\n\r\n'.encode()
print(ret)
i += 1
await sleep(1)
@app.get("/stream/<string:channel>")
async def stream(channel):
response = await make_response(
send_events(channel),
{
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
'Transfer-Encoding': 'chunked',
},
)
response.timeout = 5
return response
Run it via hypercorn sse_test.py:app.
The js tries to start 10 SSE connections (1000-1009), but only 6 are ever printed out by hypercorn and to the console.
I'm not sure if the cap is intended, but as far as I can tell the limitation is not documented, and not configurable. Interestingly, it also doesn't change by adding more workers, it's still 6.
Environment:
Python version: Python 3.12.1
Quart version: 0.19.4
Hypercorn version: 0.15.0
The text was updated successfully, but these errors were encountered:
I'm not sure if this belongs here or in Hypercorn.
If I create 6 SSE connections to the server, it seems to stall, and no more can be created, and it seems no requests or any kind get through. They only get through when the SSEs time out.
(Maybe relatedly, I noticed that Hypercorn doesn't want to be killed via CTRL-C when there are active SSEs.)
To reproduce, put the following code into a file called
sse_test.py
and run it.Run it via
hypercorn sse_test.py:app
.The js tries to start 10 SSE connections (1000-1009), but only 6 are ever printed out by hypercorn and to the console.
I'm not sure if the cap is intended, but as far as I can tell the limitation is not documented, and not configurable. Interestingly, it also doesn't change by adding more workers, it's still 6.
Environment:
The text was updated successfully, but these errors were encountered: