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 2022/06/28 07:50:13 UTC

[GitHub] [pulsar] BewareMyPower commented on a diff in pull request #16171: [fix][client] Fix duplicate messages caused by seek

BewareMyPower commented on code in PR #16171:
URL: https://github.com/apache/pulsar/pull/16171#discussion_r908153909


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java:
##########
@@ -248,6 +248,10 @@ private void startReceivingMessages(List<ConsumerImpl<T>> newConsumers) {
 
     private void receiveMessageFromConsumer(ConsumerImpl<T> consumer) {
         consumer.receiveAsync().thenAcceptAsync(message -> {
+            if (consumer.isDuringSeek()) {
+                receiveMessageFromConsumer(consumer);

Review Comment:
   Maybe not. But after adding the following code change to simulate a large latency in `clearReceiverQueue`:
   
   ```java
       private BatchMessageIdImpl clearReceiverQueue() {
           /* ... */
   
           try {
               Thread.sleep(500);
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
   ```
   
   The test failed again.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org