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/05/09 14:23:58 UTC

[GitHub] [rocketmq-mqtt] YxAc commented on a diff in pull request #91: fix the bug of wrong future completed condition

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


##########
mqtt-cs/src/main/java/org/apache/rocketmq/mqtt/cs/session/loop/SessionLoopImpl.java:
##########
@@ -275,11 +275,11 @@ private void addSubscriptionAndInit(Session session, Set<Subscription> subscript
             return;
         }
         session.addSubscription(subscriptions);
-        AtomicInteger result = new AtomicInteger(subscriptions.size());
         for (Subscription subscription : subscriptions) {
             queueFresh.freshQueue(session, subscription);
             Map<Queue, QueueOffset> queueOffsets = session.getQueueOffset(subscription);
             if (queueOffsets != null) {
+                AtomicInteger result = new AtomicInteger(queueOffsets.size());
                 for (Map.Entry<Queue, QueueOffset> entry : queueOffsets.entrySet()) {

Review Comment:
   Do we really need the 'result' variable? 
   we just need to judge whether the future is complete or not, and only complete once?



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