Commit 06c7246e21c7291a5ab816f7910308e0310a80fd

Authored by liuzujun
1 parent 652ef8f7

按500人分线

src/actions/RoleAction.lua
... ... @@ -288,7 +288,9 @@ function _M.loginRpc( agent, data )
288 288  
289 289 -- 注册全服广播
290 290 if not role._channelIdx then
291   - local channel = math.randomInt(1, 1)
  291 + local online = datacenter.get("onlineCount") or 0
  292 + local channel = math.floor(online / 500) + 1
  293 + --local channel = math.randomInt(1, 1)
292 294 role._channelIdx = channel
293 295 end
294 296 if not mcast_util.channel_world() then
... ...
src/services/agent_ctrl.lua
... ... @@ -141,10 +141,11 @@ function _M:check_agent_status()
141 141 end
142 142 end
143 143  
  144 + datacenter.set("onlineCount", count)
144 145 if now >= next_log_time and now % 60 == 0 then
145 146 next_log_time = now + 60
146 147 local count = table_nums(self.u2f)
147   - datacenter.set("onlineCount", count)
  148 + --datacenter.set("onlineCount", count)
148 149 logproxy:log({["@type"] = "online", count = count}, "log")
149 150 end
150 151 end
... ...
src/services/watchdog.lua
... ... @@ -56,7 +56,7 @@ end
56 56  
57 57 -- 创建world以及union channel 用于广播
58 58 function create_mutilcast()
59   - for i = 1, 10 do
  59 + for i = 1, 50 do
60 60 local chan_w = mc:new()
61 61 datacenter.set("MC_W_CHANNEL" .. i, chan_w.channel)
62 62 end
... ...