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 2022/04/22 01:01:48 UTC

[GitHub] [rocketmq] hzh0425 commented on a diff in pull request #4179: [ISSUE #4154] fix the thread-safe problem in `selectOneMessageQueue`

hzh0425 commented on code in PR #4179:
URL: https://github.com/apache/rocketmq/pull/4179#discussion_r855692287


##########
client/src/main/java/org/apache/rocketmq/client/latency/MQFaultStrategy.java:
##########
@@ -69,16 +69,17 @@ public MessageQueue selectOneMessageQueue(final TopicPublishInfo tpInfo, final S
                 }
 
                 final String notBestBroker = latencyFaultTolerance.pickOneAtLeast();
-                int writeQueueNums = tpInfo.getQueueIdByBroker(notBestBroker);
-                if (writeQueueNums > 0) {
-                    final MessageQueue mq = tpInfo.selectOneMessageQueue();
-                    if (notBestBroker != null) {
+                if (notBestBroker != null) {
+                    int writeQueueNums = tpInfo.getQueueIdByBroker(notBestBroker);
+                    if (writeQueueNums > 0) {
+                        MessageQueue mq = new MessageQueue();
+                        mq.setTopic(tpInfo.getMessageQueueList().get(0).getTopic());

Review Comment:
   Why use Topic0 directly here?



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