dajac commented on code in PR #12847:
URL: https://github.com/apache/kafka/pull/12847#discussion_r1035631913
##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -1696,45 +1696,37 @@ class KafkaApis(val requestChannel: RequestChannel,
def handleSyncGroupRequest(request: RequestChannel.Request, requestLocal:
RequestLocal): Unit = {
val syncGroupRequest = request.body[SyncGroupRequest]
- def sendResponseCallback(syncGroupResult: SyncGroupResult): Unit = {
- requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs =>
- new SyncGroupResponse(
- new SyncGroupResponseData()
- .setErrorCode(syncGroupResult.error.code)
- .setProtocolType(syncGroupResult.protocolType.orNull)
- .setProtocolName(syncGroupResult.protocolName.orNull)
- .setAssignment(syncGroupResult.memberAssignment)
- .setThrottleTimeMs(requestThrottleMs)
- ))
+ def sendResponse(response: AbstractResponse): Unit = {
+ trace("Sending sync group response %s for correlation id %d to client
%s."
+ .format(response, request.header.correlationId,
request.header.clientId))
+ requestHelper.sendResponseMaybeThrottle(request, requestThrottleMs => {
+ response.maybeSetThrottleTimeMs(requestThrottleMs)
+ response
+ })
Review Comment:
I have mainly kept `sendResponse` because of the `trace` log there. I have
refactored this a but in the last commit. Let me know what you think.
--
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]