You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/13 08:48:44 UTC

[GitHub] [pulsar] 315157973 commented on a change in pull request #10188: [broker] Limit the number of producers/consumers that can connect per topic for each IP address

315157973 commented on a change in pull request #10188:
URL: https://github.com/apache/pulsar/pull/10188#discussion_r611568091



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java
##########
@@ -134,6 +136,15 @@ public Producer(Topic topic, TransportCnx cnx, long producerId, String producerN
         this.schemaVersion = schemaVersion;
         this.accessMode = accessMode;
         this.topicEpoch = topicEpoch;
+
+        if (cnx.hasHAProxyMessage()) {

Review comment:
       There is duplicate code here, this logic may be abstracted into cnx

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -1435,6 +1435,17 @@ public int getNumberOfConsumers() {
         return count;
     }
 
+    @Override
+    public int getNumberOfSameAddressConsumers(final String clientAddress) {

Review comment:
       Maybe we can abstract the duplicate  code. Both `NonPersistentSubscription` and `PersistentSubscription` belong to Subscription.
   
   




-- 
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:
users@infra.apache.org