Skip to content

Commit

Permalink
[Fix][Producer] Reconnection backoff logic for producer (#1125)
Browse files Browse the repository at this point in the history
Co-authored-by: gunli <gunli@tencent.com>
  • Loading branch information
gunli and gunli committed Nov 4, 2023
1 parent 0845e73 commit 64c87a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,18 +396,18 @@ func (p *partitionProducer) reconnectToBroker() {
maxRetry = int(*p.options.MaxReconnectToBroker)
}

var (
delayReconnectTime time.Duration
defaultBackoff = internal.DefaultBackoff{}
)

for maxRetry != 0 {
if p.getProducerState() != producerReady {
// Producer is already closing
p.log.Info("producer state not ready, exit reconnect")
return
}

var (
delayReconnectTime time.Duration
defaultBackoff = internal.DefaultBackoff{}
)

if p.options.BackoffPolicy == nil {
delayReconnectTime = defaultBackoff.Next()
} else {
Expand Down

0 comments on commit 64c87a0

Please sign in to comment.