tianliuliu commented on code in PR #82:
URL: https://github.com/apache/rocketmq-mqtt/pull/82#discussion_r857059220


##########
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:
   in the old code, the var maxLoopCount=2, but it may be cause the getNextId 
become slow ,then hang the thread



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

Reply via email to