[ISSUE #1018] Fix unintended shutdown of shared rmqClient
caused by missing ref count
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 @@
import (
"context"
- "errors"
"fmt"
"net"
"os"
@@ -385,10 +384,8 @@
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 @@
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)