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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6e2697ecb1 JAMES-3822 MailQueue::enqueueReactive is blocking and 
should be executed on the boundedElastic scheduler
6e2697ecb1 is described below

commit 6e2697ecb1cdfd04e8b31be80ec50711b0ea5c8d
Author: Quan Tran <[email protected]>
AuthorDate: Tue Sep 26 10:39:19 2023 +0700

    JAMES-3822 MailQueue::enqueueReactive is blocking and should be executed on 
the boundedElastic scheduler
    
    RabbitMQ was not effected thanks to it own reactive implementation. While 
other implementations e.g. Pulsar was blocked.
    
    TODO one day override the real reactive implementation for Pulsar.
---
 .../src/main/java/org/apache/james/queue/api/MailQueue.java          | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
 
b/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
index 84cedbb904..f11acc5c4b 100644
--- 
a/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
+++ 
b/server/queue/queue-api/src/main/java/org/apache/james/queue/api/MailQueue.java
@@ -32,6 +32,7 @@ import org.threeten.extra.Temporals;
 import com.github.fge.lambdas.Throwing;
 
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 /**
  * <p>
@@ -113,7 +114,9 @@ public interface MailQueue extends Closeable {
     Publisher<Void> enqueueReactive(Mail mail);
 
     default Publisher<Void> enqueueReactive(Mail mail, Duration delay) {
-        return Mono.fromRunnable(Throwing.runnable(() -> enQueue(mail, 
delay)).sneakyThrow());
+        return Mono.fromRunnable(Throwing.runnable(() -> enQueue(mail, 
delay)).sneakyThrow())
+            .subscribeOn(Schedulers.boundedElastic())
+            .then();
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to