This is an automated email from the ASF dual-hosted git repository.
xyz 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 2154d70 Fix reconnection backoff logic (#1008)
2154d70 is described below
commit 2154d70c0fd9c215b9e494046e094f665396c983
Author: xiaolong ran <[email protected]>
AuthorDate: Fri Apr 14 15:52:40 2023 +0800
Fix reconnection backoff logic (#1008)
Signed-off-by: xiaolongran <[email protected]>
---
pulsar/consumer_partition.go | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pulsar/consumer_partition.go b/pulsar/consumer_partition.go
index fb77d0d..a8ba7b5 100644
--- a/pulsar/consumer_partition.go
+++ b/pulsar/consumer_partition.go
@@ -1525,6 +1525,11 @@ func (pc *partitionConsumer) reconnectToBroker() {
maxRetry = int(*pc.options.maxReconnectToBroker)
}
+ var (
+ delayReconnectTime time.Duration
+ defaultBackoff = internal.DefaultBackoff{}
+ )
+
for maxRetry != 0 {
if pc.getConsumerState() != consumerReady {
// Consumer is already closing
@@ -1532,11 +1537,6 @@ func (pc *partitionConsumer) reconnectToBroker() {
return
}
- var (
- delayReconnectTime time.Duration
- defaultBackoff = internal.DefaultBackoff{}
- )
-
if pc.options.backoffPolicy == nil {
delayReconnectTime = defaultBackoff.Next()
} else {