This is an automated email from the ASF dual-hosted git repository. tison 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 64c87a0a [Fix][Producer] Reconnection backoff logic for producer (#1125) 64c87a0a is described below commit 64c87a0a6895ceaeb14ac39432adafbef54d007e Author: gunli <24350...@qq.com> AuthorDate: Sat Nov 4 11:14:07 2023 +0800 [Fix][Producer] Reconnection backoff logic for producer (#1125) Co-authored-by: gunli <gu...@tencent.com> --- pulsar/producer_partition.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pulsar/producer_partition.go b/pulsar/producer_partition.go index e214979d..8608df3d 100755 --- a/pulsar/producer_partition.go +++ b/pulsar/producer_partition.go @@ -396,6 +396,11 @@ 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 @@ -403,11 +408,6 @@ func (p *partitionProducer) reconnectToBroker() { return } - var ( - delayReconnectTime time.Duration - defaultBackoff = internal.DefaultBackoff{} - ) - if p.options.BackoffPolicy == nil { delayReconnectTime = defaultBackoff.Next() } else {