Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(im/wecom): resolve longconn deadlock between closeConn and heartbeatLoop
ycc6b0d8d10573b
diff --git a/internal/im/wecom/longconn.go b/internal/im/wecom/longconn.goindex f038b7e56..7d1b2538d 100644--- a/internal/im/wecom/longconn.go+++ b/internal/im/wecom/longconn.go@@ -380,9 +380,7 @@ func (c *LongConnClient) connectAndRun(ctx context.Context) error {c.mu.Unlock()defer func() {- c.mu.Lock()- c.conn = nil- c.mu.Unlock()+ c.closeConn()_ = conn.Close()// NOTE: streamBufs is intentionally NOT cleared on reconnect.// Active streams survive reconnections — the WeCom replace-based@@ -707,9 +705,11 @@ func (c *LongConnClient) convertMixedMessage(msg *botMessage, chatID string, cha// pending ReadMessage call in the receive loop and triggers a reconnection.func (c *LongConnClient) closeConn() {c.mu.Lock()- defer c.mu.Unlock()- if c.conn != nil {- _ = c.conn.Close()+ conn := c.conn+ c.conn = nil+ c.mu.Unlock()+ if conn != nil {+ _ = conn.Close()}}