You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "codelipenghui (via GitHub)" <gi...@apache.org> on 2023/06/13 23:41:00 UTC

[GitHub] [pulsar] codelipenghui commented on a diff in pull request #20573: [fix] [broker]Consumption stuck due to orphan consumers after the connection reconnect

codelipenghui commented on code in PR #20573:
URL: https://github.com/apache/pulsar/pull/20573#discussion_r1228809167


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1243,20 +1243,11 @@ protected void handleSubscribe(final CommandSubscribe subscribe) {
                                 return topic.subscribe(option);
                             }
                         })
-                        .thenAccept(consumer -> {
-                            if (consumerFuture.complete(consumer)) {
-                                log.info("[{}] Created subscription on topic {} / {}",
-                                        remoteAddress, topicName, subscriptionName);
-                                commandSender.sendSuccessResponse(requestId);
-                                if (brokerInterceptor != null) {
-                                    try {
-                                        brokerInterceptor.consumerCreated(this, consumer, metadata);
-                                    } catch (Throwable t) {
-                                        log.error("Exception occur when intercept consumer created.", t);
-                                    }
-                                }
-                            } else {
-                                // The consumer future was completed before by a close command
+                        .thenAcceptAsync(consumer -> {
+                            if (consumerFuture.complete(consumer) || !isActive()) {

Review Comment:
   ```suggestion
                               if (!consumerFuture.complete(consumer) || !isActive()) {
   ```



-- 
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-unsubscribe@pulsar.apache.org

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