Denovo1998 commented on code in PR #24974:
URL: https://github.com/apache/pulsar/pull/24974#discussion_r2534153329
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java:
##########
@@ -433,50 +435,56 @@ public CompletableFuture<GetTopicsResult>
getTopicsUnderNamespace(NamespaceName
private void getTopicsUnderNamespace(
NamespaceName namespace,
Backoff backoff,
- AtomicLong remainingTime,
+ long startTimeNanos,
+ long retryUntilNanos,
CompletableFuture<GetTopicsResult>
getTopicsResultFuture,
Mode mode,
String topicsPattern,
String topicsHash) {
- long startTime = System.nanoTime();
-
-
client.getCnxPool().getConnection(serviceNameResolver).thenAcceptAsync(clientCnx
-> {
+
client.getCnxPool().getConnection(serviceNameResolver).thenComposeAsync(clientCnx
-> {
long requestId = client.newRequestId();
- ByteBuf request = Commands.newGetTopicsOfNamespaceRequest(
- namespace.toString(), requestId, mode, topicsPattern,
topicsHash);
-
- clientCnx.newGetTopicsOfNamespace(request,
requestId).whenComplete((r, t) -> {
- if (t != null) {
- histoListTopics.recordFailure(System.nanoTime() -
startTime);
- getTopicsResultFuture.completeExceptionally(t);
+ ByteBuf request =
Commands.newGetTopicsOfNamespaceRequest(namespace.toString(), requestId, mode,
+ topicsPattern, topicsHash);
+ return clientCnx.newGetTopicsOfNamespace(request,
requestId).whenComplete((r, t) -> {
+ client.getCnxPool().releaseConnection(clientCnx);
+ });
+ }, lookupPinnedExecutor).whenComplete((r, t) -> {
+ if (t != null) {
+ Throwable cause = FutureUtil.unwrapCompletionException(t);
+ if (cause instanceof PulsarClientException &&
!PulsarClientException.isRetriableError(cause)) {
Review Comment:
Is it covered in the test here?
--
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]