chibenwa commented on code in PR #2018:
URL: https://github.com/apache/james-project/pull/2018#discussion_r1500453764


##########
mailbox/opensearch/src/main/java/org/apache/james/mailbox/opensearch/events/OpenSearchListeningMessageSearchIndex.java:
##########
@@ -296,7 +299,14 @@ private Mono<Void> handleMailboxEvent(Event event, 
MailboxSession session, Mailb
     private Mono<Void> processAddedEvent(MailboxSession session, 
MailboxEvents.Added addedEvent, MailboxId mailboxId) {
         return factory.getMailboxMapper(session)
             .findMailboxById(mailboxId)
-            .flatMap(mailbox -> handleAdded(session, mailbox, addedEvent));
+            .flatMap(mailbox -> processAdded(session, mailbox, addedEvent));
+    }
+
+    private Mono<Void> processAdded(MailboxSession session, Mailbox mailbox, 
MailboxEvents.Added addedEvent) {
+        if (IndexBody.YES.equals(indexBody)) {
+            return handleAdded(session, mailbox, addedEvent, FetchType.FULL);
+        }
+        return handleAdded(session, mailbox, addedEvent, FetchType.HEADERS);

Review Comment:
   Only choose the FetchType amd avoid code duplication please



-- 
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: notifications-unsubscr...@james.apache.org

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


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

Reply via email to