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

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


The following commit(s) were added to refs/heads/master by this push:
     new 43186ad  [#888] incr instanceCount in once and fmt codes (#888)
43186ad is described below

commit 43186adbaebbba856ac4ea3342c6f80fcc542468
Author: Xuexue <[email protected]>
AuthorDate: Mon Oct 17 14:38:52 2022 +0800

    [#888] incr instanceCount in once and fmt codes (#888)
---
 consumer/consumer.go | 2 --
 internal/client.go   | 4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/consumer/consumer.go b/consumer/consumer.go
index 26e874c..b0f26dd 100644
--- a/consumer/consumer.go
+++ b/consumer/consumer.go
@@ -276,9 +276,7 @@ func (dc *defaultConsumer) start() error {
                retryTopic := internal.GetRetryTopic(dc.consumerGroup)
                sub := buildSubscriptionData(retryTopic, MessageSelector{TAG, 
_SubAll})
                dc.subscriptionDataTable.Store(retryTopic, sub)
-       }
 
-       if dc.model == Clustering {
                dc.option.ChangeInstanceNameToPID()
                dc.storage = NewRemoteOffsetStore(dc.consumerGroup, dc.client, 
dc.client.GetNameSrv())
        } else {
diff --git a/internal/client.go b/internal/client.go
index e3c48ed..811aa64 100644
--- a/internal/client.go
+++ b/internal/client.go
@@ -384,8 +384,10 @@ func GetOrNewRocketMQClient(option ClientOptions, 
callbackCh chan interface{}) R
 func (c *rmqClient) Start() {
        //ctx, cancel := context.WithCancel(context.Background())
        //c.cancel = cancel
-       atomic.AddInt32(&c.instanceCount, 1)
        c.once.Do(func() {
+
+               atomic.AddInt32(&c.instanceCount, 1)
+
                if !c.option.Credentials.IsEmpty() {
                        
c.remoteClient.RegisterInterceptor(remote.ACLInterceptor(c.option.Credentials))
                }

Reply via email to