lianetm commented on code in PR #15202:
URL: https://github.com/apache/kafka/pull/15202#discussion_r1462698984


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java:
##########
@@ -770,8 +785,22 @@ public NetworkClientDelegate.UnsentRequest 
toUnsentRequest() {
                         new ArrayList<>(this.requestedPartitions),
                         throwOnFetchStableOffsetUnsupported);
             }
-            return new NetworkClientDelegate.UnsentRequest(builder, 
coordinatorRequestManager.coordinator())
-                    .whenComplete((r, t) -> onResponse(r.receivedTimeMs(), 
(OffsetFetchResponse) r.responseBody()));
+            NetworkClientDelegate.UnsentRequest request =
+                new NetworkClientDelegate.UnsentRequest(builder, 
coordinatorRequestManager.coordinator());
+            return request.whenComplete((response, error) -> {
+                if (error == null) {
+                    onResponse(response.receivedTimeMs(), 
(OffsetFetchResponse) response.responseBody());
+                } else {
+                    log.debug("OffsetFetch completed with error for partitions 
{}", requestedPartitions, error);
+                    long currentTimeMs = request.handler().completionTimeMs();
+                    handleCoordinatorDisconnect(error, currentTimeMs);
+                    if (error instanceof RetriableException) {
+                        maybeRetry(currentTimeMs, error);
+                    } else {
+                        future.completeExceptionally(error);
+                    }
+                }

Review Comment:
   Totally. I moved all the logic for building the request and handling the 
client response to a common place.



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