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 90562c2ddce42d194463358a18c8490005342962 Author: Benoit Tellier <[email protected]> AuthorDate: Mon Mar 23 11:17:08 2020 +0700 [Build time] Speedup ComputeMessageFastViewProjectionListenerTest One minute build time gains --- .../james/mailbox/events/RetryBackoffConfiguration.java | 12 ++++++------ .../event/ComputeMessageFastViewProjectionListenerTest.java | 8 +++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/events/RetryBackoffConfiguration.java b/mailbox/api/src/main/java/org/apache/james/mailbox/events/RetryBackoffConfiguration.java index a674a28..98bae12 100644 --- a/mailbox/api/src/main/java/org/apache/james/mailbox/events/RetryBackoffConfiguration.java +++ b/mailbox/api/src/main/java/org/apache/james/mailbox/events/RetryBackoffConfiguration.java @@ -28,21 +28,21 @@ import com.google.common.base.Preconditions; public class RetryBackoffConfiguration { @FunctionalInterface - interface RequireMaxRetries { + public interface RequireMaxRetries { RequireFirstBackoff maxRetries(int maxRetries); } @FunctionalInterface - interface RequireFirstBackoff { + public interface RequireFirstBackoff { RequireJitterFactor firstBackoff(Duration firstBackoff); } @FunctionalInterface - interface RequireJitterFactor { + public interface RequireJitterFactor { ReadyToBuild jitterFactor(double jitterFactor); } - static class ReadyToBuild { + public static class ReadyToBuild { private final int maxRetries; private final Duration firstBackoff; private final double jitterFactor; @@ -53,12 +53,12 @@ public class RetryBackoffConfiguration { this.jitterFactor = jitterFactor; } - RetryBackoffConfiguration build() { + public RetryBackoffConfiguration build() { return new RetryBackoffConfiguration(maxRetries, firstBackoff, jitterFactor); } } - static RequireMaxRetries builder() { + public static RequireMaxRetries builder() { return maxRetries -> firstBackoff -> jitterFactor -> new ReadyToBuild(maxRetries, firstBackoff, jitterFactor); } diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/event/ComputeMessageFastViewProjectionListenerTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/event/ComputeMessageFastViewProjectionListenerTest.java index aa20d96..1194d0c 100644 --- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/event/ComputeMessageFastViewProjectionListenerTest.java +++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/event/ComputeMessageFastViewProjectionListenerTest.java @@ -26,6 +26,7 @@ import static org.mockito.Mockito.spy; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.time.Duration; import org.apache.james.core.Username; import org.apache.james.jmap.api.model.Preview; @@ -102,10 +103,15 @@ class ComputeMessageFastViewProjectionListenerTest { @BeforeEach void setup() throws Exception { eventDeadLetters = new MemoryEventDeadLetters(); + RetryBackoffConfiguration backoffConfiguration = RetryBackoffConfiguration.builder() + .maxRetries(2) + .firstBackoff(Duration.ofMillis(1)) + .jitterFactor(0.5) + .build(); InMemoryIntegrationResources resources = InMemoryIntegrationResources.builder() .preProvisionnedFakeAuthenticator() .fakeAuthorizator() - .eventBus(new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), RetryBackoffConfiguration.DEFAULT, eventDeadLetters)) + .eventBus(new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), backoffConfiguration, eventDeadLetters)) .defaultAnnotationLimits() .defaultMessageParser() .scanningSearchIndex() --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
