Skip to content

Commit

Permalink
Default Lettuce shutdownQuietPeriod to zero.
Browse files Browse the repository at this point in the history
Use a lower timeout for faster shutdown. Also, the quiet period is no longer configured through the shutdown timeout.

Closes #2945
  • Loading branch information
mp911de committed Aug 8, 2024
1 parent fbf94b1 commit 96e4692
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DefaultLettuceClientConfiguration implements LettuceClientConfiguration {
DefaultLettuceClientConfiguration(boolean useSsl, boolean verifyPeer, boolean startTls,
@Nullable ClientResources clientResources, @Nullable ClientOptions clientOptions, @Nullable String clientName,
@Nullable ReadFrom readFrom, @Nullable RedisCredentialsProviderFactory redisCredentialsProviderFactory,
Duration timeout, Duration shutdownTimeout, @Nullable Duration shutdownQuietPeriod) {
Duration timeout, Duration shutdownTimeout, Duration shutdownQuietPeriod) {

this.useSsl = useSsl;
this.verifyPeer = verifyPeer;
Expand All @@ -61,7 +61,7 @@ class DefaultLettuceClientConfiguration implements LettuceClientConfiguration {
this.redisCredentialsProviderFactory = Optional.ofNullable(redisCredentialsProviderFactory);
this.timeout = timeout;
this.shutdownTimeout = shutdownTimeout;
this.shutdownQuietPeriod = shutdownQuietPeriod != null ? shutdownQuietPeriod : shutdownTimeout;
this.shutdownQuietPeriod = shutdownQuietPeriod;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class LettuceClientConfigurationBuilder {
@Nullable RedisCredentialsProviderFactory redisCredentialsProviderFactory;
Duration timeout = Duration.ofSeconds(RedisURI.DEFAULT_TIMEOUT);
Duration shutdownTimeout = Duration.ofMillis(100);
@Nullable Duration shutdownQuietPeriod;
Duration shutdownQuietPeriod = Duration.ZERO;

LettuceClientConfigurationBuilder() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@
*/
class LettuceClientConfigurationUnitTests {

@Test // DATAREDIS-574, DATAREDIS-576, DATAREDIS-667, DATAREDIS-918
@Test // DATAREDIS-574, DATAREDIS-576, DATAREDIS-667, DATAREDIS-918, GH-2945
void shouldCreateEmptyConfiguration() {

LettuceClientConfiguration configuration = LettuceClientConfiguration.defaultConfiguration();


assertThat(configuration.isUseSsl()).isFalse();
assertThat(configuration.isVerifyPeer()).isTrue();
assertThat(configuration.isStartTls()).isFalse();
Expand All @@ -55,7 +54,7 @@ void shouldCreateEmptyConfiguration() {
assertThat(configuration.getClientName()).isEmpty();
assertThat(configuration.getCommandTimeout()).isEqualTo(Duration.ofSeconds(60));
assertThat(configuration.getShutdownTimeout()).isEqualTo(Duration.ofMillis(100));
assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ofMillis(100));
assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ZERO);
}

@Test // DATAREDIS-574, DATAREDIS-576, DATAREDIS-667
Expand Down Expand Up @@ -88,13 +87,13 @@ void shouldConfigureAllProperties() {
}

@Test // DATAREDIS-881
void shutdownQuietPeriodShouldDefaultToTimeout() {
void shutdownQuietPeriodShouldDefaultInitialValue() {

LettuceClientConfiguration configuration = LettuceClientConfiguration.builder()
.shutdownTimeout(Duration.ofSeconds(42)).build();

assertThat(configuration.getShutdownTimeout()).isEqualTo(Duration.ofSeconds(42));
assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ofSeconds(42));
assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ZERO);
}

@Test // DATAREDIS-576
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*/
class LettucePoolingClientConfigurationUnitTests {

@Test // DATAREDIS-667, DATAREDIS-918
@Test // DATAREDIS-667, DATAREDIS-918, GH-2945
void shouldCreateEmptyConfiguration() {

LettucePoolingClientConfiguration configuration = LettucePoolingClientConfiguration.defaultConfiguration();
Expand All @@ -55,7 +55,7 @@ void shouldCreateEmptyConfiguration() {
assertThat(configuration.getClientResources()).isEmpty();
assertThat(configuration.getCommandTimeout()).isEqualTo(Duration.ofSeconds(60));
assertThat(configuration.getShutdownTimeout()).isEqualTo(Duration.ofMillis(100));
assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ofMillis(100));
assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ZERO);
}

@Test // DATAREDIS-667
Expand Down

0 comments on commit 96e4692

Please sign in to comment.