jolshan commented on code in PR #12848:
URL: https://github.com/apache/kafka/pull/12848#discussion_r1036350719


##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -1764,42 +1764,38 @@ class KafkaApis(val requestChannel: RequestChannel,
     })
   }
 
-  def handleHeartbeatRequest(request: RequestChannel.Request): Unit = {
+  def handleHeartbeatRequest(request: RequestChannel.Request): 
CompletableFuture[Unit] = {
     val heartbeatRequest = request.body[HeartbeatRequest]
 
-    // the callback for sending a heartbeat response
-    def sendResponseCallback(error: Errors): Unit = {
-      def createResponse(requestThrottleMs: Int): AbstractResponse = {
-        val response = new HeartbeatResponse(
-          new HeartbeatResponseData()
-            .setThrottleTimeMs(requestThrottleMs)
-            .setErrorCode(error.code))
-        trace("Sending heartbeat response %s for correlation id %d to client 
%s."
-          .format(response, request.header.correlationId, 
request.header.clientId))
+    def sendResponse(response: AbstractResponse): Unit = {
+      trace("Sending heartbeat response %s for correlation id %d to client %s."
+        .format(response, request.header.correlationId, 
request.header.clientId))
+      requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs => {

Review Comment:
   Yeah -- I left this comment on all the other PRs. David said he would rebase.



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