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 2021/05/14 06:42:41 UTC
[james-project] 09/15: [REFACTORING] GroupRegistration was doing
acks on the parallel pool
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 deb3d6d76a7c7e853b61df7720e27a9e19830a69
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat May 8 14:49:59 2021 +0700
[REFACTORING] GroupRegistration was doing acks on the parallel pool
Detected thanks to https://github.com/reactor/BlockHound
ACKs are blocking (as we send a message over the
network to RabbitMQ). Doing that on the parallel pool
is bad as it "steals" threads dedicated to non
blocking tasks and slows the entire application down.
---
.../src/main/java/org/apache/james/events/GroupRegistration.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/event-bus/distributed/src/main/java/org/apache/james/events/GroupRegistration.java b/event-bus/distributed/src/main/java/org/apache/james/events/GroupRegistration.java
index a33638b..4a83f81 100644
--- a/event-bus/distributed/src/main/java/org/apache/james/events/GroupRegistration.java
+++ b/event-bus/distributed/src/main/java/org/apache/james/events/GroupRegistration.java
@@ -145,7 +145,7 @@ class GroupRegistration implements Registration {
.flatMap(event -> delayGenerator.delayIfHaveTo(currentRetryCount)
.flatMap(any -> runListener(event))
.onErrorResume(throwable -> retryHandler.handleRetry(event, currentRetryCount, throwable))
- .then(Mono.<Void>fromRunnable(acknowledgableDelivery::ack)))
+ .then(Mono.<Void>fromRunnable(acknowledgableDelivery::ack).subscribeOn(Schedulers.elastic())))
.onErrorResume(e -> {
LOGGER.error("Unable to process delivery for group {}", group, e);
return Mono.fromRunnable(() -> acknowledgableDelivery.nack(!REQUEUE));
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org