BewareMyPower commented on code in PR #24934:
URL: https://github.com/apache/pulsar/pull/24934#discussion_r2486418188


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java:
##########
@@ -161,7 +163,21 @@ private NavigableMap<Integer, Integer> makeHashRing(int 
consumerSize) {
         return Collections.unmodifiableNavigableMap(hashRing);
     }
 
-    public synchronized CompletableFuture<Void> addConsumer(Consumer consumer) 
{
+    public CompletableFuture<Void> addConsumer(Consumer consumer) {
+        return internalAddConsumer(consumer, 0);
+    }
+
+    private synchronized CompletableFuture<Void> internalAddConsumer(Consumer 
consumer, int retryCount) {
+        if (retryCount >= MAX_RETRY_COUNT_FOR_ADD_CONSUMER_RACE) {
+            log.warn("[{}] The active consumer's connection is still inactive 
after all retries, remove {} by force",
+                    getName(), consumer);
+            try {
+                removeConsumer(consumer);

Review Comment:
   Yes, please check the latest test for the updated behavior



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

Reply via email to