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 a968b11ea576d951d6dcf62f8c3f01aa51b2cc76
Author: Benoit Tellier <[email protected]>
AuthorDate: Fri May 7 18:40:26 2021 +0700

    [REFACTORING] Wrap blocking calls in UserProvisioner
    
    It was forcing to schedule the whole chain on an elastic scheduler...
---
 .../src/main/java/org/apache/james/jmap/http/UserProvisioner.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/http/UserProvisioner.java
 
b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/http/UserProvisioner.java
index 1ac9aac..599228f 100644
--- 
a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/http/UserProvisioner.java
+++ 
b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/http/UserProvisioner.java
@@ -35,6 +35,7 @@ import org.apache.james.user.api.UsersRepositoryException;
 import com.google.common.annotations.VisibleForTesting;
 
 import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
 
 public class UserProvisioner {
     private final UsersRepository usersRepository;
@@ -49,7 +50,9 @@ public class UserProvisioner {
 
     public Mono<Void> provisionUser(MailboxSession session) {
         if (session != null && !usersRepository.isReadOnly()) {
-            return Mono.fromRunnable(() -> createAccountIfNeeded(session));
+            return Mono.fromRunnable(() -> createAccountIfNeeded(session))
+                .subscribeOn(Schedulers.elastic())
+                .then();
         }
         return Mono.empty();
     }

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

Reply via email to