mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 20:57:32 +08:00
fix(mcp-session): send SSE endpoint event via local goroutine InjectData (#3567)
This commit is contained in:
@@ -140,10 +140,16 @@ func (s *SSEServer) HandleSSE(cb api.FilterCallbackHandler, stopChan chan struct
|
|||||||
|
|
||||||
// Send the initial endpoint event
|
// Send the initial endpoint event
|
||||||
initialEvent := fmt.Sprintf("event: endpoint\ndata: %s\n\n", messageEndpoint)
|
initialEvent := fmt.Sprintf("event: endpoint\ndata: %s\n\n", messageEndpoint)
|
||||||
err = s.redisClient.Publish(channel, initialEvent)
|
go func() {
|
||||||
if err != nil {
|
defer func() {
|
||||||
api.LogErrorf("Failed to send initial event: %v", err)
|
if r := recover(); r != nil {
|
||||||
}
|
api.LogErrorf("Failed to send initial event: %v", r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
defer cb.EncoderFilterCallbacks().RecoverPanic()
|
||||||
|
api.LogDebugf("SSE Send message: %s", initialEvent)
|
||||||
|
cb.EncoderFilterCallbacks().InjectData([]byte(initialEvent))
|
||||||
|
}()
|
||||||
|
|
||||||
// Start health check handler
|
// Start health check handler
|
||||||
go func() {
|
go func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user