You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/05/28 01:16:22 UTC

[james-project] 07/07: [PERFORMANCE] SetMessagesCreationProcessor: avoid elastic scheduling when no attachments

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 1a1a08a05877b7b6da4745167a295b6314670e5b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sun May 23 11:54:01 2021 +0700

    [PERFORMANCE] SetMessagesCreationProcessor: avoid elastic scheduling when no attachments
---
 .../java/org/apache/james/jmap/draft/methods/AttachmentChecker.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/AttachmentChecker.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/AttachmentChecker.java
index 9f2d104..e6bca89 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/AttachmentChecker.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/AttachmentChecker.java
@@ -47,8 +47,12 @@ public class AttachmentChecker {
     }
 
     public Mono<Void> assertAttachmentsExist(ValueWithId.CreationMessageEntry entry, MailboxSession session) {
+        List<Attachment> attachments = entry.getValue().getAttachments();
+
+        if (attachments.isEmpty()) {
+            return Mono.empty();
+        }
         return Mono.fromRunnable(Throwing.runnable(() -> {
-            List<Attachment> attachments = entry.getValue().getAttachments();
             List<BlobId> notFounds = listAttachmentsNotFound(attachments, session);
             if (!notFounds.isEmpty()) {
                 throw new AttachmentsNotFoundException(notFounds);

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