You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "chibenwa (via GitHub)" <gi...@apache.org> on 2023/03/11 07:31:02 UTC

[GitHub] [james-project] chibenwa commented on a diff in pull request #1477: JAMES-3440 Fixbug: Data race issue with JMAP email query view

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


##########
server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PopulateEmailQueryViewListener.java:
##########
@@ -156,13 +157,22 @@ private Mono<Void> handleAdded(Added added) {
 
     private Mono<Void> handleAdded(Added added, MessageMetaData messageMetaData, MailboxSession session) {
         MessageId messageId = messageMetaData.getMessageId();
+        MailboxId mailboxId = added.getMailboxId();
 
-        return Flux.from(messageIdManager.getMessagesReactive(ImmutableList.of(messageId), FetchGroup.HEADERS, session))
-            .next()
+        return checkMessageStillInOriginMailbox(messageId, session, mailboxId)
+            .filter(FunctionalUtils.identityPredicate())
+            .flatMap(stillInOriginMailbox -> Flux.from(messageIdManager.getMessagesReactive(ImmutableList.of(messageId), FetchGroup.HEADERS, session))
+                .next())
             .filter(message -> !message.getFlags().contains(DELETED))
             .flatMap(messageResult -> handleAdded(added.getMailboxId(), messageResult));
     }

Review Comment:
   Please do this check only if `added.getMailboxPath().getName().isEqualTo(OUTBOX)` to limit its cost....



-- 
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-unsubscribe@james.apache.org

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


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