mz0113 commented on code in PR #4179:
URL: https://github.com/apache/rocketmq/pull/4179#discussion_r913318999
##########
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:
> @MatrixHB Second this. Same confusion here. Could you please explain why
directly apply topic 0 here?
the topic of all messageQueue in the tpInfo.getMessageQueueList() is same,so
you can choose any one,but if you get(1,2,3,4,....),may cause
arrayIndexOutOfboundsException,so we get(0),if the size() ==0,it would not go
into this method
--
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]