close mongoManager and redisManager connections on proxy shutdown

master
Alex 2022-03-20 20:45:37 +01:00
parent ebcd6d1a58
commit 9a2f0ab15c
2 changed files with 10 additions and 1 deletions

View File

@ -85,6 +85,11 @@ public class ProxySystem extends Plugin {
this.kraSocketClient.getSocketClient().getConnection().close();
this.kraSocketClient.getSocketClient().getConnection().closeConnection(1, "");
this.mongoManager.getMongoClient().close();
this.redisManager.getConnection().close();
this.redisManager.getClient().shutdown();
instance = null;
}

View File

@ -2,6 +2,7 @@ package net.krakatoa.proxy.redis;
import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.reactive.RedisKeyReactiveCommands;
import io.lettuce.core.api.sync.RedisStringCommands;
import lombok.Data;
@ -13,12 +14,15 @@ public class RedisManager {
private RedisClient client;
private StatefulRedisConnection<String, String> connection;
private RedisStringCommands<String, String> commands;
private RedisKeyReactiveCommands<String, String> keyReactiveCommands;
public void connect() {
this.client = RedisClient.create(this.getConnectionUri());
this.connection = client.connect();
this.commands = connection.sync();
this.keyReactiveCommands = client.connect().reactive();
commands.set("test", "im here");
this.getKeyReactiveCommands().del("player");
}
}
// RedisKeyReactiveCommands