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

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


The following commit(s) were added to refs/heads/master by this push:
     new da06dca2 dobule check before consumer reconnect (#1084)
da06dca2 is described below

commit da06dca2935c087c51365c846ed2116a5ac0d653
Author: zccold <[email protected]>
AuthorDate: Sat Oct 21 19:56:17 2023 +0800

    dobule check before consumer reconnect (#1084)
---
 pulsar/consumer_partition.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pulsar/consumer_partition.go b/pulsar/consumer_partition.go
index 364dae75..2ba84274 100644
--- a/pulsar/consumer_partition.go
+++ b/pulsar/consumer_partition.go
@@ -1644,6 +1644,13 @@ func (pc *partitionConsumer) reconnectToBroker() {
                pc.log.Info("Reconnecting to broker in ", delayReconnectTime)
                time.Sleep(delayReconnectTime)
 
+               // double check
+               if pc.getConsumerState() != consumerReady {
+                       // Consumer is already closing
+                       pc.log.Info("consumer state not ready, exit reconnect")
+                       return
+               }
+
                err := pc.grabConn()
                if err == nil {
                        // Successfully reconnected

Reply via email to