You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/11/01 02:44:33 UTC

[GitHub] [rocketmq] tsunghanjacktsai commented on a diff in pull request #5435: Delete Duplicate Code in DefaultRequestProcessor

tsunghanjacktsai commented on code in PR #5435:
URL: https://github.com/apache/rocketmq/pull/5435#discussion_r1010024557


##########
namesrv/src/main/java/org/apache/rocketmq/namesrv/processor/DefaultRequestProcessor.java:
##########
@@ -635,40 +635,40 @@ private RemotingCommand updateConfig(ChannelHandlerContext ctx, RemotingCommand
         return response;
     }
 
-    private RemotingCommand getConfig(ChannelHandlerContext ctx, RemotingCommand request) {
+  private RemotingCommand getConfig(ChannelHandlerContext ctx, RemotingCommand request) {
         final RemotingCommand response = RemotingCommand.createResponseCommand(null);
 
         String content = this.namesrvController.getConfiguration().getAllConfigsFormatString();
+        if (getResponse(response, content)) {
+            return response;
+        }
+
+        response.setCode(ResponseCode.SUCCESS);
+        response.setRemark(null);
+        return response;
+    }
+
+    private boolean getResponse(RemotingCommand response, String content) {

Review Comment:
   Well, returning true/false with the name `getResponse` here seems a bit odd, since it returns true only if there's an exception being caught. How about considering a better method name to make it more readable?



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org