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


The following commit(s) were added to refs/heads/master by this push:
     new b1b50c3cf3 JAMES-3534 Avoid blocking calls in Identity/set
b1b50c3cf3 is described below

commit b1b50c3cf37699068030d9fab2a99f1f978d0143
Author: Benoit Tellier <[email protected]>
AuthorDate: Fri May 6 15:31:26 2022 +0700

    JAMES-3534 Avoid blocking calls in Identity/set
---
 .../org/apache/james/jmap/api/identity/CustomIdentityDAO.scala    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
 
b/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
index cfa4fb2217..24222cc61e 100644
--- 
a/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
+++ 
b/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
@@ -19,6 +19,10 @@
 
 package org.apache.james.jmap.api.identity
 
+import java.nio.charset.StandardCharsets
+import java.util.UUID
+
+import javax.inject.Inject
 import org.apache.james.core.{MailAddress, Username}
 import org.apache.james.jmap.api.model.{EmailAddress, 
ForbiddenSendFromException, HtmlSignature, Identity, IdentityId, IdentityName, 
MayDeleteIdentity, TextSignature}
 import org.apache.james.rrt.api.CanSendFrom
@@ -27,9 +31,6 @@ import org.reactivestreams.Publisher
 import reactor.core.scala.publisher.{SFlux, SMono}
 import reactor.core.scheduler.Schedulers
 
-import java.nio.charset.StandardCharsets
-import java.util.UUID
-import javax.inject.Inject
 import scala.jdk.StreamConverters._
 import scala.util.Try
 
@@ -158,6 +159,7 @@ class IdentityRepository @Inject()(customIdentityDao: 
CustomIdentityDAO, identit
   def update(user: Username, identityId: IdentityId, identityUpdateRequest: 
IdentityUpdateRequest): Publisher[Unit] = {
     val findServerSetIdentity: SMono[Option[Identity]] = SMono.fromCallable(() 
=> identityFactory.listIdentities(user)
       .find(identity => identity.id.equals(identityId)))
+      .subscribeOn(Schedulers.elastic)
     val findCustomIdentity: SMono[Option[Identity]] = 
SMono(customIdentityDao.findByIdentityId(user, identityId))
       .map(Some(_))
       .switchIfEmpty(SMono.just(None))


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

Reply via email to