BewareMyPower commented on code in PR #1208:
URL: https://github.com/apache/pulsar-client-go/pull/1208#discussion_r1576335249


##########
pulsar/producer_partition.go:
##########
@@ -429,12 +453,22 @@ func (p *partitionProducer) reconnectToBroker() {
                        return
                }
 
-               if p.options.BackoffPolicy == nil {
+               var assignedBrokerURL string
+
+               if connectionClosed != nil && connectionClosed.HasURL() {
+                       delayReconnectTime = 0
+                       assignedBrokerURL = connectionClosed.assignedBrokerURL
+                       connectionClosed = nil // Only attempt once

Review Comment:
   Sorry I didn't get it. Could you explain it with more details?
   
   > if the initial connection attempt fails with the given assigned URL
   
   Did you mean `p.grabCnx(assignedBrokerURL)` failed? If so, 
`reconnectToBroker` would just return and would be called when the next time 
`ConnectionClosed` is called.
   
   How can assigning a local variable (`connectionClosed`) to nil just resume 
the established reconnection?



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to