shohi commented on a change in pull request #360:
URL: https://github.com/apache/pulsar-client-go/pull/360#discussion_r476186223
##########
File path: pulsar/producer_partition.go
##########
@@ -236,8 +236,18 @@ func (p *partitionProducer) ConnectionClosed() {
}
func (p *partitionProducer) reconnectToBroker() {
- backoff := internal.Backoff{}
- for {
+ var (
+ maxRetry int
+ backoff = internal.Backoff{}
+ )
+
+ if p.options.MaxReconnectToBroker == nil {
+ maxRetry = -1
+ } else {
+ maxRetry = int(*p.options.MaxReconnectToBroker)
+ }
Review comment:
The handling for uninitialized maxRetry seems not correct, it may be
better to extract the retry test into a separate function, e.g `shouldRetry`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]