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
commit 7fa59ded0afb5621195683de91bdccbda1cdd971 Author: Benoit Tellier <[email protected]> AuthorDate: Wed Nov 11 14:13:53 2020 +0700 JAMES-3171 Limit concurrency in JMAP methods --- .../main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala | 3 ++- .../org/apache/james/jmap/method/MailboxSetDeletePerformer.scala | 3 ++- .../org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala | 7 +++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala index c13bf3a..a7adf77 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxGetMethod.scala @@ -108,7 +108,8 @@ class MailboxGetMethod @Inject() (serializer: MailboxSerializer, case Some(ids) => SFlux.fromIterable(ids.value) .flatMap(id => Try(mailboxIdFactory.fromString(id.value)) .fold(e => SMono.just(MailboxGetResults.notFound(id)), - mailboxId => getMailboxResultById(capabilities, mailboxId, mailboxSession))) + mailboxId => getMailboxResultById(capabilities, mailboxId, mailboxSession)), + maxConcurrency = 5) } private def getMailboxResultById(capabilities: Set[CapabilityIdentifier], diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala index 3ccd8f4..de5d4ea 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala @@ -67,7 +67,8 @@ class MailboxSetDeletePerformer @Inject()(mailboxManager: MailboxManager, def deleteMailboxes(mailboxSession: MailboxSession, mailboxSetRequest: MailboxSetRequest): SMono[MailboxDeletionResults] = { SFlux.fromIterable(mailboxSetRequest.destroy.getOrElse(Seq())) .flatMap(id => delete(mailboxSession, id, mailboxSetRequest.onDestroyRemoveEmails.getOrElse(RemoveEmailsOnDestroy(false))) - .onErrorRecover(e => MailboxDeletionFailure(id, e))) + .onErrorRecover(e => MailboxDeletionFailure(id, e)), + maxConcurrency = 5) .collectSeq() .map(MailboxDeletionResults) } diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala index f208989..c82e5c3 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala @@ -92,7 +92,7 @@ class MailboxSetUpdatePerformer @Inject()(serializer: MailboxSerializer, e => SMono.just(MailboxUpdateFailure(unparsedMailboxId, e, None)), mailboxId => updateMailbox(mailboxSession, mailboxId, unparsedMailboxId, patch, capabilities)) .onErrorResume(e => SMono.just(MailboxUpdateFailure(unparsedMailboxId, e, None))) - }) + }, maxConcurrency = 5) .collectSeq() .map(MailboxUpdateResults) } @@ -216,9 +216,8 @@ class MailboxSetUpdatePerformer @Inject()(serializer: MailboxSerializer, }).getOrElse(SMono.empty) val partialUpdatesOperation: SMono[Unit] = SFlux.fromIterable(validatedPatch.rightsPartialUpdates) - .flatMap(partialUpdate => SMono.fromCallable(() => { - mailboxManager.applyRightsCommand(mailboxId, partialUpdate.asACLCommand(), mailboxSession) - })) + .flatMap(partialUpdate => SMono.fromCallable(() => mailboxManager.applyRightsCommand(mailboxId, partialUpdate.asACLCommand(), mailboxSession)), + maxConcurrency = 5) .`then`() SFlux.merge(Seq(resetOperation, partialUpdatesOperation)) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
