From 049dcbe5892aeff015546d8b0323b94cc6ba1c92 Mon Sep 17 00:00:00 2001 From: William Date: Sun, 6 Feb 2022 14:56:48 +0000 Subject: [PATCH] Fix rare EndOfStream exception with Jedis listener --- .../java/me/william278/husksync/redis/RedisListener.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/me/william278/husksync/redis/RedisListener.java b/common/src/main/java/me/william278/husksync/redis/RedisListener.java index 7f4dcf42..ceed919f 100644 --- a/common/src/main/java/me/william278/husksync/redis/RedisListener.java +++ b/common/src/main/java/me/william278/husksync/redis/RedisListener.java @@ -24,14 +24,18 @@ public abstract class RedisListener { * Creates a new RedisListener and initialises the Redis connection */ public RedisListener() { + JedisPoolConfig config = new JedisPoolConfig(); + config.setMaxIdle(0); + config.setTestOnBorrow(true); + config.setTestOnReturn(true); if (Settings.redisPassword.isEmpty()) { - jedisPool = new JedisPool(new JedisPoolConfig(), + jedisPool = new JedisPool(config, Settings.redisHost, Settings.redisPort, 0, Settings.redisSSL); } else { - jedisPool = new JedisPool(new JedisPoolConfig(), + jedisPool = new JedisPool(config, Settings.redisHost, Settings.redisPort, 0,