lhotari commented on code in PR #24423:
URL: https://github.com/apache/pulsar/pull/24423#discussion_r2357636813


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -437,11 +449,37 @@ public void channelInactive(ChannelHandlerContext ctx) 
throws Exception {
         }
     }
 
+    protected void checkRateLimit(BaseCommand cmd) {
+        if (cmd.getType() == BaseCommand.Type.PONG && cmd.getType() == 
BaseCommand.Type.PING) {
+            return;
+        }
+        if (requestRateLimiter.acquire(1) == 0 && !pausedDueToRateLimitation) {
+            log.warn("[{}] Reached rate limitation", this);
+            // Stop receiving requests.
+            pausedDueToRateLimitation = true;
+            ctx.channel().config().setAutoRead(false);

Review Comment:
   Fair enough, I don't want to argue here. My opinion remains that in this 
case there isn't a need for 2 separate PRs and that this PR should target 
master branch and follow the architecture that is present after 
[PIP-322](https://github.com/apache/pulsar/blob/master/pip/pip-322.md) for 
controlling the auto read state of ServerCtx inbound channel. 
https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnxThrottleTracker.java
   is the class that controls auto read state.
   



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