Commit 06c7246e21c7291a5ab816f7910308e0310a80fd
1 parent
652ef8f7
按500人分线
Showing
3 changed files
with
6 additions
and
3 deletions
Show diff stats
src/actions/RoleAction.lua
| @@ -288,7 +288,9 @@ function _M.loginRpc( agent, data ) | @@ -288,7 +288,9 @@ function _M.loginRpc( agent, data ) | ||
| 288 | 288 | ||
| 289 | -- 注册全服广播 | 289 | -- 注册全服广播 |
| 290 | if not role._channelIdx then | 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 | role._channelIdx = channel | 294 | role._channelIdx = channel |
| 293 | end | 295 | end |
| 294 | if not mcast_util.channel_world() then | 296 | if not mcast_util.channel_world() then |
src/services/agent_ctrl.lua
| @@ -141,10 +141,11 @@ function _M:check_agent_status() | @@ -141,10 +141,11 @@ function _M:check_agent_status() | ||
| 141 | end | 141 | end |
| 142 | end | 142 | end |
| 143 | 143 | ||
| 144 | + datacenter.set("onlineCount", count) | ||
| 144 | if now >= next_log_time and now % 60 == 0 then | 145 | if now >= next_log_time and now % 60 == 0 then |
| 145 | next_log_time = now + 60 | 146 | next_log_time = now + 60 |
| 146 | local count = table_nums(self.u2f) | 147 | local count = table_nums(self.u2f) |
| 147 | - datacenter.set("onlineCount", count) | 148 | + --datacenter.set("onlineCount", count) |
| 148 | logproxy:log({["@type"] = "online", count = count}, "log") | 149 | logproxy:log({["@type"] = "online", count = count}, "log") |
| 149 | end | 150 | end |
| 150 | end | 151 | end |
src/services/watchdog.lua
| @@ -56,7 +56,7 @@ end | @@ -56,7 +56,7 @@ end | ||
| 56 | 56 | ||
| 57 | -- 创建world以及union channel 用于广播 | 57 | -- 创建world以及union channel 用于广播 |
| 58 | function create_mutilcast() | 58 | function create_mutilcast() |
| 59 | - for i = 1, 10 do | 59 | + for i = 1, 50 do |
| 60 | local chan_w = mc:new() | 60 | local chan_w = mc:new() |
| 61 | datacenter.set("MC_W_CHANNEL" .. i, chan_w.channel) | 61 | datacenter.set("MC_W_CHANNEL" .. i, chan_w.channel) |
| 62 | end | 62 | end |