AnonHxy commented on code in PR #16540:
URL: https://github.com/apache/pulsar/pull/16540#discussion_r942063830
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceTest.java:
##########
@@ -1056,7 +1105,12 @@ public void testLookupThrottlingForClientByClient()
throws Exception {
long reqId10 = reqId++;
ByteBuf request10 = Commands.newLookup(topicName, true, reqId10);
f3 = pool.getConnection(resolver.resolveHost())
- .thenCompose(clientCnx -> clientCnx.newLookup(request10,
reqId10));
+ .thenCompose(clientCnx -> {
+ CompletableFuture<?> future =
clientCnx.newLookup(request10, reqId10);
+ // pending other responses in `ClientCnx` until now
+ latch[0].countDown();
Review Comment:
I think `f1` and `f2` and `f3` could all complete successfully if we do so.
The reason is that:
`clientCnx.newLookup` will be called in another thread, so
`latch[0].countDown()` could happen before all `newLookup` requeset sending,
that will cause the latch has no effect in this test.
In order to make sure `f3.get()` fail, we must block handing response in
`clientCnx` until the third `newLookup` have send. @poorbarcode
--
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]