fix automatic reconnect in case of network issues

This commit is contained in:
Moehritz 2016-03-11 02:19:40 +01:00
parent 4980ec6a0d
commit b71dbd8283
1 changed files with 8 additions and 1 deletions

View File

@ -519,7 +519,14 @@ public final class RedisBungee extends Plugin {
// FIXME: Extremely ugly hack
// Attempt to unsubscribe this instance and try again.
getLogger().log(Level.INFO, "PubSub error, attempting to recover.", e);
jpsh.unsubscribe();
try {
jpsh.unsubscribe();
} catch (Exception e1) {
/* This may fail with
- java.net.SocketException: Broken pipe
- redis.clients.jedis.exceptions.JedisConnectionException: JedisPubSub was not subscribed to a Jedis instance
*/
}
broken = true;
}
}