You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/07/01 16:21:54 UTC

[GitHub] [rocketmq] AshleyLiuuuuu commented on a change in pull request #3106: [ISSUE #3105]Fix: when the param "time" is set to now , call function…

AshleyLiuuuuu commented on a change in pull request #3106:
URL: https://github.com/apache/rocketmq/pull/3106#discussion_r662430229



##########
File path: tools/src/main/java/org/apache/rocketmq/tools/command/offset/ResetOffsetByTimeCommand.java
##########
@@ -75,7 +75,8 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) t
             String group = commandLine.getOptionValue("g").trim();
             String topic = commandLine.getOptionValue("t").trim();
             String timeStampStr = commandLine.getOptionValue("s").trim();
-            long timestamp = timeStampStr.equals("now") ? System.currentTimeMillis() : 0;
+            //when the param "timestamp" is set to now,it should return the max offset of this queue
+            long timestamp = timeStampStr.equals("now") ? -1 : 0;

Review comment:
       We can also set a static variable "TIMESTAMP_BY_NOW" with a value of -1 to indicate more clearly that the timestamp entered by the user is "now", and you can also see that if the timestamp is not "now" in the code, the initial value is 0, but it will be assigned to the specific timestamp entered by the user afterwards, which means that the user does not need to pay attention to the details that will be encapsulated. So in terms of business,as long as the timestamp entered is "now", the process of getting the current maximum timestamp will be fine.Of course ,add some comments will be relatively more friendly :)




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

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