tianliuliu commented on code in PR #82:
URL: https://github.com/apache/rocketmq-mqtt/pull/82#discussion_r857214091
##########
mqtt-cs/src/main/java/org/apache/rocketmq/mqtt/cs/session/infly/MqttMsgId.java:
##########
@@ -59,22 +59,17 @@ public int nextId(String clientId) {
MsgIdEntry msgIdEntry = hashMsgID(clientId);
synchronized (msgIdEntry) {
int startingMessageId = msgIdEntry.nextMsgId;
- int loopCount = 0;
- int maxLoopCount = 1;
do {
msgIdEntry.nextMsgId++;
if (msgIdEntry.nextMsgId > MAX_MSG_ID) {
msgIdEntry.nextMsgId = MIN_MSG_ID;
}
if (msgIdEntry.nextMsgId == startingMessageId) {
- loopCount++;
- if (loopCount >= maxLoopCount) {
Review Comment:
> Under most cases, the method 'releaseId' which release 'inUseMsgIds' is
enough, unless lots of message accumulation happens. Once the extreme case
occurs, i think it makes no difference/sense to run the loop once or twice.
>
> so may I remove the loop judgment and keep this change? @pingww @tianliuliu
you are right. the cause is exactly it.
--
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]