2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-22 20:28:00 +00:00

ServerConnectedEvent task doesn't really benefit from pipelining. Possible fix for #23?

This commit is contained in:
Tux 2015-08-01 18:00:29 -04:00
parent f0164c3c8c
commit 431ff013e1

View File

@ -158,12 +158,10 @@ public class RedisBungeeListener implements Listener {
plugin.getProxy().getScheduler().runAsync(plugin, new RedisCallable<Void>(plugin) { plugin.getProxy().getScheduler().runAsync(plugin, new RedisCallable<Void>(plugin) {
@Override @Override
protected Void call(Jedis jedis) { protected Void call(Jedis jedis) {
Pipeline pipeline = jedis.pipelined(); jedis.hset("player:" + event.getPlayer().getUniqueId().toString(), "server", event.getServer().getInfo().getName());
pipeline.hset("player:" + event.getPlayer().getUniqueId().toString(), "server", event.getServer().getInfo().getName()); jedis.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(
pipeline.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(
event.getPlayer().getUniqueId(), DataManager.DataManagerMessage.Action.SERVER_CHANGE, event.getPlayer().getUniqueId(), DataManager.DataManagerMessage.Action.SERVER_CHANGE,
new DataManager.ServerChangePayload(event.getServer().getInfo().getName())))); new DataManager.ServerChangePayload(event.getServer().getInfo().getName()))));
pipeline.sync();
return null; return null;
} }
}); });