9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00

make redis thread blocking

This commit is contained in:
XiaoMoMi
2024-07-31 00:31:04 +08:00
parent 35ce90aa65
commit e819f6b079
2 changed files with 1 additions and 2 deletions

View File

@@ -274,6 +274,7 @@ public class BukkitStorageManager implements StorageManager, Listener {
}
if (triedTimes >= 6) {
waitLock(uuid, 3);
task.cancel();
return;
}
redisManager.getPlayerData(uuid, false).thenAccept(optionalData -> {

View File

@@ -265,7 +265,6 @@ public class RedisManager extends AbstractStorage {
@Override
public CompletableFuture<Optional<PlayerData>> getPlayerData(UUID uuid, boolean lock) {
var future = new CompletableFuture<Optional<PlayerData>>();
plugin.getScheduler().async().execute(() -> {
try (Jedis jedis = jedisPool.getResource()) {
byte[] key = getRedisKey("cf_data", uuid);
byte[] data = jedis.get(key);
@@ -278,7 +277,6 @@ public class RedisManager extends AbstractStorage {
} catch (Exception e) {
future.complete(Optional.empty());
}
});
return future;
}