From 8d3681dc1f021262353473baaecbb11022270208 Mon Sep 17 00:00:00 2001 From: Tux Date: Sun, 21 Jun 2015 20:27:27 -0400 Subject: [PATCH] Make some Lua calls local to increase performance. --- src/main/resources/lua/server_to_players.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/resources/lua/server_to_players.lua b/src/main/resources/lua/server_to_players.lua index b985f69..0fa7264 100644 --- a/src/main/resources/lua/server_to_players.lua +++ b/src/main/resources/lua/server_to_players.lua @@ -1,15 +1,18 @@ -- This script needs all active proxies available specified as args. +local insert = table.insert +local call = redis.call + local serverToData = {} for _, proxy in ipairs(ARGV) do - local players = redis.call("SMEMBERS", "proxy:" .. proxy .. ":usersOnline") + local players = call("SMEMBERS", "proxy:" .. proxy .. ":usersOnline") for _, player in ipairs(players) do - local server = redis.call("HGET", "player:" .. player, "server") + local server = call("HGET", "player:" .. player, "server") if server then if not serverToData[server] then serverToData[server] = {} end - table.insert(serverToData[server], player) + insert(serverToData[server], player) end end end