diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 790be03..326fbd1 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -288,7 +288,9 @@ function _M.loginRpc( agent, data ) -- 注册全服广播 if not role._channelIdx then - local channel = math.randomInt(1, 1) + local online = datacenter.get("onlineCount") or 0 + local channel = math.floor(online / 500) + 1 + --local channel = math.randomInt(1, 1) role._channelIdx = channel end if not mcast_util.channel_world() then diff --git a/src/services/agent_ctrl.lua b/src/services/agent_ctrl.lua index 48c54af..e8f1019 100644 --- a/src/services/agent_ctrl.lua +++ b/src/services/agent_ctrl.lua @@ -141,10 +141,11 @@ function _M:check_agent_status() end end + datacenter.set("onlineCount", count) if now >= next_log_time and now % 60 == 0 then next_log_time = now + 60 local count = table_nums(self.u2f) - datacenter.set("onlineCount", count) + --datacenter.set("onlineCount", count) logproxy:log({["@type"] = "online", count = count}, "log") end end diff --git a/src/services/watchdog.lua b/src/services/watchdog.lua index 5c29637..62e4512 100644 --- a/src/services/watchdog.lua +++ b/src/services/watchdog.lua @@ -56,7 +56,7 @@ end -- 创建world以及union channel 用于广播 function create_mutilcast() - for i = 1, 10 do + for i = 1, 50 do local chan_w = mc:new() datacenter.set("MC_W_CHANNEL" .. i, chan_w.channel) end -- libgit2 0.21.2