RedisCommandTimeoutException выпуск салата - PullRequest
0 голосов
/ 24 декабря 2018

Я подключаюсь к Redis со следующей конфигурацией пула салата:

   #  other properties
   spring.redis.timeout=10000
   spring.redis.test-on-borrow=true
   spring.redis.test-while-idle=true
   spring.redis.lettuce.pool.max-active=100
   spring.redis.lettuce.pool.max-idle=100
   spring.redis.lettuce.pool.min-idle=5
   spring.redis.lettuce.pool.max-wait=5000

Мой класс конфигурации:

@Bean
LettuceConnectionFactory lettuceConnectionFactory(RedisProperties
redisProperties) {

    GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setTestOnReturn(true);
    poolConfig.setMaxIdle(redisProperties.getMaxIdle());
    poolConfig.setMinIdle(redisProperties.getMinIdle());
    poolConfig.setMaxWaitMillis(redisProperties.getMaxWait());
    poolConfig.setMaxTotal(redisProperties.getMaxActive());
    poolConfig.setTestOnBorrow(redisProperties.isTestOnBorrow());
    poolConfig.setTestWhileIdle(redisProperties.isTestWhileIdle());

    LettuceClientConfiguration lettuceClientConfiguration =
    LettucePoolingClientConfiguration.builder()
        .commandTimeout(Duration.ofMillis(redisProperties.getTimeout()))
        .poolConfig(poolConfig)
        .build();
    //  other config
    LettuceConnectionFactory lettuceConnectionFactory = new
    LettuceConnectionFactory(redisSentinelConfiguration,
    lettuceClientConfiguration);
    lettuceConnectionFactory.afterPropertiesSet();
    return lettuceConnectionFactory;
}

Он работает при запуске, но через некоторое время выдает RedisCommandTimeoutExceptionвремени (без операций в течение этого периода времени).так как testOnborrow и testOnIdle не работают.Кто-нибудь знает это?

...