mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-23 04:28:01 +00:00
remove lua files and do it in java, due Redis not supporting lua quite well in cluster mode, some scripts were added recently will be kept
This commit is contained in:
parent
f1f74b6456
commit
019bb30c09
@ -27,7 +27,7 @@ public class LuaManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Script clusterJedisTask(JedisCluster jedisCluster) {
|
public Script clusterJedisTask(JedisCluster jedisCluster) {
|
||||||
String hash = jedisCluster.scriptLoad(script, null);
|
String hash = jedisCluster.scriptLoad(script, "0");
|
||||||
return new Script(script, hash);
|
return new Script(script, hash);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
local c = redis.call
|
|
||||||
|
|
||||||
local curTime = c("TIME")
|
|
||||||
local time = tonumber(curTime[1])
|
|
||||||
|
|
||||||
local heartbeats = c("HGETALL", "heartbeats")
|
|
||||||
local total = 0
|
|
||||||
local key
|
|
||||||
|
|
||||||
for _, v in ipairs(heartbeats) do
|
|
||||||
if not key then
|
|
||||||
key = v
|
|
||||||
else
|
|
||||||
local n = tonumber(v)
|
|
||||||
if n then
|
|
||||||
if n + 30 >= time then
|
|
||||||
total = total + c("SCARD", "proxy:" .. key .. ":usersOnline")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
key = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return total
|
|
@ -1,18 +0,0 @@
|
|||||||
local call = redis.call
|
|
||||||
local ipairs = ipairs
|
|
||||||
|
|
||||||
local serverToData = {}
|
|
||||||
|
|
||||||
for _, proxy in ipairs(ARGV) do
|
|
||||||
local players = call("SMEMBERS", "proxy:" .. proxy .. ":usersOnline")
|
|
||||||
for _, player in ipairs(players) do
|
|
||||||
local server = call("HGET", "player:" .. player, "server")
|
|
||||||
if server then
|
|
||||||
local sz = #serverToData
|
|
||||||
serverToData[sz + 1] = server
|
|
||||||
serverToData[sz + 2] = player
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return serverToData
|
|
Loading…
Reference in New Issue
Block a user