Skip to content

Commit

Permalink
dobule check before consumer reconnect (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
zccold authored Oct 21, 2023
1 parent 0bf2f9b commit da06dca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pulsar/consumer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da06dca

Please sign in to comment.