This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit eeaa8fe0678c02f26fd480714df84ee75d3dda62
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Tue Jun 25 08:15:06 2019 +0700

    JAMES-2794 RabbitMQ should not dequeue deleted elements
---
 .../java/org/apache/james/queue/rabbitmq/Dequeuer.java   | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Dequeuer.java
 
b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Dequeuer.java
index db5352c..01db228 100644
--- 
a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Dequeuer.java
+++ 
b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Dequeuer.java
@@ -95,13 +95,15 @@ class Dequeuer {
 
     private Mono<RabbitMQMailQueueItem> filterIfDeleted(RabbitMQMailQueueItem 
item) {
         return mailQueueView.isPresent(item.getEnqueueId())
-            .flatMap(isPresent -> {
-                if (isPresent) {
-                    return Mono.just(item);
-                }
-                item.done(true);
-                return Mono.empty();
-            });
+            .flatMap(isPresent -> keepWhenPresent(item, isPresent));
+    }
+
+    private Mono<? extends RabbitMQMailQueueItem> 
keepWhenPresent(RabbitMQMailQueueItem item, Boolean isPresent) {
+        if (isPresent) {
+            return Mono.just(item);
+        }
+        item.done(true);
+        return Mono.empty();
     }
 
     private Mono<RabbitMQMailQueueItem> loadItem(AcknowledgableDelivery 
response) {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to