An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: kernel/api/broadcast: modernize with wg.Go (#17282)
iliya31a1b17440da
diff --git a/kernel/api/broadcast.go b/kernel/api/broadcast.goindex d12d405904..910448c2eb 100644--- a/kernel/api/broadcast.go+++ b/kernel/api/broadcast.go@@ -188,11 +188,8 @@ func (s *EventSourceServer) SendEvent(event *MessageEvent) bool {// Subscribe subscribes to specified broadcast channelsfunc (s *EventSourceServer) Subscribe(c *gin.Context, retry uint, channels ...string) {wg := sync.WaitGroup{}- wg.Add(len(channels))for _, channel := range channels {- go func() {- defer wg.Done()-+ wg.Go(func() {var broadcastChannel *BroadcastChannel_broadcastChannel, exist := BroadcastChannels.Load(channel)if exist { // channel exists, use it@@ -201,7 +198,7 @@ func (s *EventSourceServer) Subscribe(c *gin.Context, retry uint, channels ...stbroadcastChannel = ConstructBroadcastChannel(channel)}broadcastChannel.Subscriber.Count++- }()+ })}wg.Wait()