You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by cs...@apache.org on 2023/04/28 03:14:51 UTC

[rocketmq-client-go] branch master updated: [ISSUE #1018] Fix unintended shutdown of shared rmqClient

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

cserwen 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 8ea107c  [ISSUE #1018] Fix unintended shutdown of shared rmqClient
8ea107c is described below

commit 8ea107c9b0ffb8aea61b9ea581899023a7b9b5a6
Author: Gordon Wang <13...@gmail.com>
AuthorDate: Fri Apr 28 11:14:46 2023 +0800

    [ISSUE #1018] Fix unintended shutdown of shared rmqClient
    
    caused by missing ref count
---
 internal/client.go | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/internal/client.go b/internal/client.go
index f7b2aec..486dffd 100644
--- a/internal/client.go
+++ b/internal/client.go
@@ -19,7 +19,6 @@ package internal
 
 import (
 	"context"
-	"errors"
 	"fmt"
 	"net"
 	"os"
@@ -385,10 +384,8 @@ 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))
 		}
@@ -704,7 +701,7 @@ func (c *rmqClient) ProcessSendResponse(brokerName string, cmd *remote.RemotingC
 	case ResSuccess:
 		status = primitive.SendOK
 	default:
-		return errors.New(fmt.Sprintf("CODE: %d, DESC: %s", cmd.Code, cmd.Remark))
+		return fmt.Errorf("CODE: %d, DESC: %s", cmd.Code, cmd.Remark)
 	}
 
 	msgIDs := make([]string, 0)