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:
@@ -274,6 +274,7 @@ public class BukkitStorageManager implements StorageManager, Listener {
|
|||||||
}
|
}
|
||||||
if (triedTimes >= 6) {
|
if (triedTimes >= 6) {
|
||||||
waitLock(uuid, 3);
|
waitLock(uuid, 3);
|
||||||
|
task.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
redisManager.getPlayerData(uuid, false).thenAccept(optionalData -> {
|
redisManager.getPlayerData(uuid, false).thenAccept(optionalData -> {
|
||||||
|
|||||||
@@ -265,7 +265,6 @@ public class RedisManager extends AbstractStorage {
|
|||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Optional<PlayerData>> getPlayerData(UUID uuid, boolean lock) {
|
public CompletableFuture<Optional<PlayerData>> getPlayerData(UUID uuid, boolean lock) {
|
||||||
var future = new CompletableFuture<Optional<PlayerData>>();
|
var future = new CompletableFuture<Optional<PlayerData>>();
|
||||||
plugin.getScheduler().async().execute(() -> {
|
|
||||||
try (Jedis jedis = jedisPool.getResource()) {
|
try (Jedis jedis = jedisPool.getResource()) {
|
||||||
byte[] key = getRedisKey("cf_data", uuid);
|
byte[] key = getRedisKey("cf_data", uuid);
|
||||||
byte[] data = jedis.get(key);
|
byte[] data = jedis.get(key);
|
||||||
@@ -278,7 +277,6 @@ public class RedisManager extends AbstractStorage {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
future.complete(Optional.empty());
|
future.complete(Optional.empty());
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user