Polishing.

Allow Jedis to exist pub/sub loop gracefully. Await unsubscribe. Reduce retry backoff to allow from broken connection recovery. Do not use pooling to avoid using broken connections.

See #2256
This commit is contained in:
Mark Paluch
2022-02-17 16:24:39 +01:00
parent bc07540b9a
commit d34c45bfe4
4 changed files with 76 additions and 28 deletions

View File

@@ -56,7 +56,7 @@ public class JedisConnectionFactoryExtension implements ParameterResolver {
.create(JedisConnectionFactoryExtension.class);
private static final JedisClientConfiguration CLIENT_CONFIGURATION = JedisClientConfiguration.builder()
.clientName("jedis-client").usePooling().build();
.clientName("jedis-client").build();
private static final NewableLazy<JedisConnectionFactory> STANDALONE = NewableLazy.of(() -> {

View File

@@ -63,6 +63,7 @@ class RedisMessageListenerContainerIntegrationTests {
void setUp() {
container = new RedisMessageListenerContainer();
container.setRecoveryInterval(100);
container.setConnectionFactory(connectionFactory);
container.setBeanName("container");
container.afterPropertiesSet();

View File

@@ -81,7 +81,7 @@ class RedisMessageListenerContainerUnitTests {
doAnswer(it -> {
Runnable r = it.getArgument(0);
new Thread(r).start();
r.run();
return null;
}).when(executorMock).execute(any());
@@ -103,7 +103,7 @@ class RedisMessageListenerContainerUnitTests {
container.stop();
assertThat(container.isRunning()).isFalse();
verify(subscriptionMock).close();
verify(connectionMock).close();
}
@Test // GH-964