You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ka...@apache.org on 2023/01/17 09:24:40 UTC

[rocketmq-clients] branch master updated: feat: fixed subscriptionExpressionsLock use (#343)

This is an automated email from the ASF dual-hosted git repository.

kaili pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new aa3e9fdd feat: fixed subscriptionExpressionsLock use (#343)
aa3e9fdd is described below

commit aa3e9fddacfff080c49bcfa487014e87ad94f119
Author: chowyu12 <81...@users.noreply.github.com>
AuthorDate: Tue Jan 17 17:24:35 2023 +0800

    feat: fixed subscriptionExpressionsLock use (#343)
    
    Co-authored-by: zhouyy <zh...@ickey.cn>
---
 golang/simple_consumer.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/golang/simple_consumer.go b/golang/simple_consumer.go
index 220dd1e9..0559a88a 100644
--- a/golang/simple_consumer.go
+++ b/golang/simple_consumer.go
@@ -269,10 +269,10 @@ func (sc *defaultSimpleConsumer) Receive(ctx context.Context, maxMessageNum int3
 	}
 	sc.subscriptionExpressionsLock.RLock()
 	topics := make([]string, 0, len(sc.subscriptionExpressions))
-	sc.subscriptionExpressionsLock.RUnlock()
 	for k, _ := range sc.subscriptionExpressions {
 		topics = append(topics, k)
 	}
+	sc.subscriptionExpressionsLock.RUnlock()
 	// All topic is subscribed.
 	if len(topics) == 0 {
 		return nil, fmt.Errorf("there is no topic to receive message")