PavelZeger commented on code in PR #1490:
URL: https://github.com/apache/pulsar-client-go/pull/1490#discussion_r3212837513
##########
pulsar/consumer_partition.go:
##########
@@ -2100,6 +2102,12 @@ func (pc *partitionConsumer)
reconnectToBroker(connectionClosed *connectionClose
pc.metrics.ConsumersReconnectFailure.Inc()
if maxRetry == 0 || bo.IsMaxBackoffReached() {
pc.metrics.ConsumersReconnectMaxRetry.Inc()
+ if pc.options.maxReconnectToBrokerListener != nil {
+
pc.options.maxReconnectToBrokerListener(pc.parentConsumer, err)
+ }
+ if pc.options.closeConsumerOnMaxReconnectToBroker {
+ go pc.parentConsumer.Close()
+ }
Review Comment:
Addressed by the same patch as the previous thread - `go
pc.parentConsumer.Close()` and `maxReconnectToBrokerListener` are both inside
one `if !maxRetryNotified { … }` block, so they fire together exactly once per
reconnect cycle. Used a plain bool rather than `sync.Once/atomic` because
`opFn` is invoked sequentially by `internal.Retry` - no concurrent entry into
the closure, no race to protect against. Happy to swap to `sync.Once` if you'd
prefer the explicit signal.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]