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 2022/03/15 02:00:23 UTC

[james-project] 05/10: JAMES-3720 JMAP Drat message sender: disposal of Mail can block

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

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

commit 385814d5af8e52090c76884d43b0668d559c897a
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 4 21:12:30 2022 +0700

    JAMES-3720 JMAP Drat message sender: disposal of Mail can block
    
    This is the case for large mails whom are back by a temporary file. This
    temporary file need to be deleted... Which is blocking!
    
    Scheduling on an elastic scheduler ensures we do not block the parallel
    schedulers...
    
    (cherry picked from commit 5b1b933e258647f7680814104c2f719edf163da5)
---
 .../main/java/org/apache/james/jmap/draft/methods/MessageSender.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/MessageSender.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/MessageSender.java
index 1903c75..62d4f6c 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/MessageSender.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/MessageSender.java
@@ -38,6 +38,7 @@ import org.apache.mailet.Mail;
 import com.google.common.annotations.VisibleForTesting;
 
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 public class MessageSender {
     public static class MessageMimeMessageSource extends MimeMessageSource {
@@ -75,7 +76,7 @@ public class MessageSender {
     public Mono<Void> sendMessage(MetaDataWithContent message, Envelope envelope, MailboxSession session) {
         return Mono.usingWhen(Mono.fromCallable(() -> buildMail(message, envelope)),
             mail -> sendMessage(message.getMessageId(), mail, session),
-            mail -> Mono.fromRunnable(() -> LifecycleUtil.dispose(mail)));
+            mail -> Mono.fromRunnable(() -> LifecycleUtil.dispose(mail)).subscribeOn(Schedulers.elastic()));
     }
 
     @VisibleForTesting

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