splett2 commented on a change in pull request #9386:
URL: https://github.com/apache/kafka/pull/9386#discussion_r526528689



##########
File path: core/src/test/scala/unit/kafka/network/ConnectionQuotasTest.scala
##########
@@ -633,18 +837,27 @@ class ConnectionQuotasTest {
                                 listenerName: ListenerName,
                                 address: InetAddress,
                                 numConnections: Long,
-                                timeIntervalMs: Long) : Unit = {
+                                timeIntervalMs: Long,
+                                expectIpThrottle: Boolean): Boolean = {
     var nextSendTime = System.currentTimeMillis + timeIntervalMs
+    var ipThrottled = false
     for (_ <- 0L until numConnections) {
       // this method may block if broker-wide or listener limit on the number 
of connections is reached
-      connectionQuotas.inc(listenerName, address, 
blockedPercentMeters(listenerName.value))
-
+      try {
+        connectionQuotas.inc(listenerName, address, 
blockedPercentMeters(listenerName.value))
+      } catch {
+        case e: ConnectionThrottledException =>
+          if (!expectIpThrottle)
+            throw e
+          ipThrottled = true

Review comment:
       Thanks. I filed https://issues.apache.org/jira/browse/KAFKA-10744 for 
the clean up/conversion.




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


Reply via email to