YxAc commented on code in PR #63:
URL: https://github.com/apache/rocketmq-mqtt/pull/63#discussion_r846792963


##########
mqtt-cs/src/main/java/org/apache/rocketmq/mqtt/cs/protocol/mqtt/handler/MqttPublishHandler.java:
##########
@@ -71,16 +62,11 @@ public void doHandler(ChannelHandlerContext ctx,
             return;
         }
 
-        final boolean isQos2Message = isQos2Message(mqttMessage);
-        if (isQos2Message) {
-            if (inFlyCache.contains(InFlyCache.CacheType.PUB, channelId, 
variableHeader.messageId())) {
-                doResponse(ctx, mqttMessage);
-                return;
-            }
-        }
         doResponse(ctx, mqttMessage);
-        if (isQos2Message) {
-            inFlyCache.put(InFlyCache.CacheType.PUB, channelId, 
variableHeader.messageId());
+
+        final boolean isQos2Message = isQos2Message(mqttMessage);
+        if (isQos2Message && !inFlyCache.contains(InFlyCache.CacheType.PUB, 
channelId, variableHeader.packetId())) {
+            inFlyCache.put(InFlyCache.CacheType.PUB, channelId, 
variableHeader.packetId());

Review Comment:
   simplify the code block



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