From 7d31daa8e859a795bacd8236443a0831673e7184 Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Fri, 11 Sep 2020 14:40:39 +0800 Subject: [PATCH] 调整压测 --- robot/robot.lua | 11 ++++++----- robot/start.lua | 8 ++++---- robot/unitTest/hero.lua | 2 +- src/actions/HangAction.lua | 1 - src/actions/RoleAction.lua | 2 +- src/models/RolePlugin.lua | 20 ++++++++++---------- src/services/redisd.lua | 3 +++ 7 files changed, 25 insertions(+), 22 deletions(-) diff --git a/robot/robot.lua b/robot/robot.lua index d3c46dd..cf54b49 100644 --- a/robot/robot.lua +++ b/robot/robot.lua @@ -34,6 +34,9 @@ local ignoreListener = { ["Role.changeUpdate"] = true, ["Role.loadRunes"] = true, ["Hero.loadInfos"] = true, + ["Store.updateproperty"] = true, + ["Sys.maintainNotice"] = true, + ["Hero.drawHeroExtraRewardNtf"] = true, ["Sys.innerErrorMsg"] = function(data) local msg = MsgPack.unpack(data) log("innerErrorMsg: " .. msg.id) @@ -123,11 +126,6 @@ local function startUnit(unit) unitTest.new(client):startTest() end -local function handle_timeout10000() - rpcServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 1, pm2 = 500})) - rpcServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 2, pm2 = 500})) - skynet.timeout(10000, handle_timeout6000) -end -- 登录成功开始任务 function CMD.task() @@ -155,6 +153,9 @@ end -- 退出 function CMD.exit() + sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "gmmsg", pm1 = "123"})) + skynet.sleep(50) + skynet.ret(skynet.pack()) skynet.exit() end diff --git a/robot/start.lua b/robot/start.lua index fb6605a..79b0f9f 100644 --- a/robot/start.lua +++ b/robot/start.lua @@ -19,9 +19,9 @@ function MSG.open( ... ) end function MSG.close(fd) - if fd2serv[fd] then - skynet.send(fd2serv[fd].agent, "lua", "exit") - + if fd2serv[fd] and not fd2serv[fd].closing then + fd2serv[fd].closing = true + skynet.call(fd2serv[fd].agent, "lua", "exit") log(string_format("logout %s", fd2serv[fd].id)) id2fd[fd2serv[fd].id] = nil @@ -94,8 +94,8 @@ local function add_robot() -- 定时下线 skynet.timeout(math.randomInt(config.online_time[1], config.online_time[2]) * 100, function() - socketdriver.close(fd) MSG.close(fd) + socketdriver.close(fd) end) end diff --git a/robot/unitTest/hero.lua b/robot/unitTest/hero.lua index 6991c22..747b3bc 100644 --- a/robot/unitTest/hero.lua +++ b/robot/unitTest/hero.lua @@ -26,7 +26,7 @@ end function _M:drawHero() sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 3, pm2 = 400})) - requestServer(actionCodes.Hero_drawHeroRpc, MsgPack.pack({pool = 1, type = 1})) + requestServer(actionCodes.Hero_drawHeroRpc, MsgPack.pack({pool = 2, type = 1})) end function _M:drawHero10() diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index e52ca6e..e956747 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -278,7 +278,6 @@ function _M.endBattleRpc(agent, data) local cfg = csvdb["idle_battleCsv"][nextCarbonId] if cfg then hangInfo.bossTime = skynet.timex() + cfg.idle_time - print(hangInfo.bossTime) end end role:updateProperty({field = "hangInfo", value = hangInfo}) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 1aa3a6f..0f07e10 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -977,7 +977,7 @@ function _M.chatRpc(agent, data) role:log("communication", { publish_type = cmd, --发言类型,1,世界 2私聊 publish_status = 0, --发送状态,发送成功:0,发送失败:1,被屏蔽:2,其他:3 - publish_receive_roleid = msg.roleId, --接收者角色ID + publish_receive_roleid = msg.roleId or 0, --接收者角色ID publish_text = content, --发言内容 }) SendPacket(actionCodes.Role_chatRpc, MsgPack.pack({result = result, waitTime = waitTime})) diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 8c21a5d..fd179cc 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -238,7 +238,7 @@ function RolePlugin.bind(Role) end if params.log then - local log = params.log + local log = clone(params.log) if log["cint1"] or log["cint2"] then print("addPlayExp error log have cint1 or cint2 or cint3", debug.traceback()) end @@ -275,7 +275,7 @@ function RolePlugin.bind(Role) self:logItems(params.itemId, origin, nums, params.log) if params.log then - local log = params.log + local log = clone(params.log) if log["cint1"] or log["cint2"] then print("addItem error log have cint1 or cint2 ", debug.traceback()) end @@ -299,7 +299,7 @@ function RolePlugin.bind(Role) function Role:checkItemEnough(itemCountT) local less = {} if not next(itemCountT) then - return false, less + return true, less end for itemId, count in pairs(itemCountT) do if count <= 0 then @@ -360,7 +360,7 @@ function RolePlugin.bind(Role) self:logItems(ItemId.Diamond, origin, count, params.log) if params.log then - local log = params.log + local log = clone(params.log) if log["cint1"] or log["cint2"] or log["cint3"] then print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback()) end @@ -410,7 +410,7 @@ function RolePlugin.bind(Role) self:logItems(ItemId.Diamond, origin, count, params.log) if params.log then - local log = params.log + local log = clone(params.log) if log["cint1"] or log["cint2"] or log["cint3"] then print("costDiamond error log have cint1 or cint2 or cint3 ", debug.traceback()) end @@ -459,7 +459,7 @@ function RolePlugin.bind(Role) self:logItems(heroType + ItemStartId.Hero, 0, 1, params.log) if params.log then - local log = params.log + local log = clone(params.log) if log["cint1"] or log["cint2"] or log["cint3"] then print("addHero error log have cint1 or cint2 or cint3 ", debug.traceback()) end @@ -580,7 +580,7 @@ function RolePlugin.bind(Role) self:logItems(equipCsv.id, oldCount, curCount, pms.log) if pms.log then - local log = pms.log + local log = clone(pms.log) if log["cint1"] or log["cint2"] or log["cint3"] then print("addEquip error log have cint1 or cint2 or cint3 ", debug.traceback()) end @@ -656,7 +656,7 @@ function RolePlugin.bind(Role) self:logItems(params.id, 0, 1, params.log) if params.log then - local log = params.log + local log = clone(params.log) if log["cint1"] or log["cint2"] or log["cint3"] then print("addRune error log have cint1 or cint2 or cint3 ", debug.traceback()) end @@ -686,7 +686,7 @@ function RolePlugin.bind(Role) self:logItems(rune:getProperty("id"), 1, 0, params.log) if params.log then - local log = params.log + local log = clone(params.log) if log["cint1"] or log["cint2"] or log["cint3"] then print("delRunes error log have cint1 or cint2 or cint3 ", debug.traceback()) end @@ -946,7 +946,7 @@ function RolePlugin.bind(Role) self:logItems(func, 0, count, params.log) if params.log then - local log = params.log + local log = clone(params.log) if log["cint1"] or log["cint2"] or log["cint3"] then print("funcOpen error log have cint1 or cint2 or cint3 ", debug.traceback()) end diff --git a/src/services/redisd.lua b/src/services/redisd.lua index f7838fc..60ff4ac 100644 --- a/src/services/redisd.lua +++ b/src/services/redisd.lua @@ -24,5 +24,8 @@ skynet.start(function() skynet.ret(skynet.pack(db[string.lower(cmd)](db, ...))) end end) + skynet.info_func(function() + skynet.ret(skynet.pack(skynet.call(skynet.self(), "debug", "STAT"))) + end) skynet.register ".redis" end) \ No newline at end of file -- libgit2 0.21.2