From 8a34d992c50891c96727c29410d26b1d78dc3197 Mon Sep 17 00:00:00 2001 From: chaos Date: Thu, 22 Feb 2024 15:26:39 +0800 Subject: [PATCH] data race fixing. --- common/broker/grpcpubsub/client.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/broker/grpcpubsub/client.go b/common/broker/grpcpubsub/client.go index abb98e5cb1..7ffa98843e 100644 --- a/common/broker/grpcpubsub/client.go +++ b/common/broker/grpcpubsub/client.go @@ -75,7 +75,9 @@ func (s *sharedSubscriber) Unsubscribe(subId string) { delete(s.out, subId) if len(s.out) == 0 && s.cancel != nil { s.cancel() + subLock.Lock() delete(subscribers, s.sharedKey) + subLock.Unlock() } }