From bff09fb74fbcd49ce13b282ed92919769da56377 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 17 May 2020 17:38:21 -0700 Subject: [PATCH] fix looping --- weed/messaging/msgclient/subscriber.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weed/messaging/msgclient/subscriber.go b/weed/messaging/msgclient/subscriber.go index 01e63df40..caa795626 100644 --- a/weed/messaging/msgclient/subscriber.go +++ b/weed/messaging/msgclient/subscriber.go @@ -102,10 +102,10 @@ func (s *Subscriber) Subscribe(processFn func(m *messaging_pb.Message)) { for i := 0; i < len(s.subscriberClients); i++ { if s.subscriberClients[i] != nil { wg.Add(1) - go func() { + go func(subscriberClient messaging_pb.SeaweedMessaging_SubscribeClient) { defer wg.Done() - doSubscribe(s.subscriberClients[i], processFn) - }() + doSubscribe(subscriberClient, processFn) + }(s.subscriberClients[i]) } } wg.Wait()