mirror of
https://github.com/alibaba/higress.git
synced 2026-03-07 10:00:48 +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
|
||||
initialEvent := fmt.Sprintf("event: endpoint\ndata: %s\n\n", messageEndpoint)
|
||||
err = s.redisClient.Publish(channel, initialEvent)
|
||||
if err != nil {
|
||||
api.LogErrorf("Failed to send initial event: %v", err)
|
||||
}
|
||||
go func() {
|
||||
defer func() {
|
||||
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
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user