You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2017/12/09 02:04:12 UTC

[GitHub] merlimat commented on a change in pull request #942: Bugfix: duplicate messages for PartitionedConsumers.

merlimat commented on a change in pull request #942: Bugfix: duplicate messages for PartitionedConsumers.
URL: https://github.com/apache/incubator-pulsar/pull/942#discussion_r155910030
 
 

 ##########
 File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedConsumerImpl.java
 ##########
 @@ -191,7 +200,9 @@ protected Message internalReceive(int timeout, TimeUnit unit) throws PulsarClien
         Message message;
         try {
             lock.writeLock().lock();
-            message = incomingMessages.poll(0, TimeUnit.SECONDS);
+            message = (incomingMessages.size() > 0) ?
+                    incomingMessages.poll(0, TimeUnit.SECONDS) : messageFromConsumerImpl();
 
 Review comment:
   Is this part of the commit needed to address the duplicates after the timeout? Or can this portion be split into a separate change? 
   
   My concern here is that `messageFromConsumerImpl()` can be called many times and if it's checking all the partitions it might take a while.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services