-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix handle sse disconnect event to free read_stream_writers[session_id] #582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v1.3.x
Are you sure you want to change the base?
Conversation
This looks better. Can you add a test case, please? |
I added . Please check |
@@ -120,9 +120,19 @@ async def sse_writer(): | |||
} | |||
) | |||
|
|||
async def handle_see_disconnect(message: Message) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is also handled in #586. let's review that one first and then we can review this one as we have a test here -- thank you for adding it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left my thought here And I don't think add callback to connect_sse is proper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Unfortunately we can't upgrade starlette now.
-
Some of the fixes are already covered by Handle SSE Disconnects Properly #612
] | ||
|
||
[[package]] | ||
name = "starlette" | ||
version = "0.27.0" | ||
version = "0.41.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we can't upgrade starlette version now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async def handle_sse(request): | ||
async with sse.connect_sse( | ||
request.scope, request.receive, request._send | ||
) as streams: | ||
await app.run( | ||
streams[0], streams[1], app.create_initialization_options() | ||
) | ||
return Response("MCP SSE") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was already fixed by #612
Motivation and Context
When SSE Connection disconnect , we should free the
_read_stream_writers
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context