上传新的机器人框架

This commit is contained in:
liwei1dao 2023-09-08 15:08:34 +08:00
parent 6a2f3806e0
commit 74822bd141
12 changed files with 100 additions and 20 deletions

View File

@ -1,22 +1,21 @@
机器人总数: 100
成功数量: 100
机器人总数: 1
成功数量: 1
失败数量: 0
消息总吞吐量: 4209
消息总吞吐量: 47
---消息压测详情----------------------------------------------------------------------------------------------------
消息名:sys.funcgetlist 请求次数:99 耗时最小:225 ms 耗时最大:2054 ms 平均耗时:1159.22ms 中位耗时:1067.00ms
消息名:user.create 请求次数:100 耗时最小:15 ms 耗时最大:590 ms 平均耗时:227.31ms 中位耗时:193.00ms
消息名:hero.list 请求次数:99 耗时最小:26 ms 耗时最大:215 ms 平均耗时:65.18ms 中位耗时:53.00ms
消息名:equipment.getlist 请求次数:99 耗时最小:15 ms 耗时最大:53 ms 平均耗时:27.45ms 中位耗时:25.00ms
消息名:wtask.info 请求次数:99 耗时最小:22 ms 耗时最大:178 ms 平均耗时:70.98ms 中位耗时:64.00ms
消息名:wtask.battlestart 请求次数:396 耗时最小:15 ms 耗时最大:97 ms 平均耗时:34.66ms 中位耗时:29.00ms
消息名:wtask.battlefinish 请求次数:396 耗时最小:15 ms 耗时最大:482 ms 平均耗时:102.37ms 中位耗时:82.00ms
消息名:hero.drawcard 请求次数:99 耗时最小:66 ms 耗时最大:728 ms 平均耗时:328.85ms 中位耗时:295.00ms
消息名:practice.practice 请求次数:99 耗时最小:15 ms 耗时最大:43 ms 平均耗时:22.32ms 中位耗时:22.00ms
消息名:user.login 请求次数:100 耗时最小:177 ms 耗时最大:7431 ms 平均耗时:2092.23ms 中位耗时:1376.50ms
消息名:items.getlist 请求次数:99 耗时最小:22 ms 耗时最大:119 ms 平均耗时:53.21ms 中位耗时:50.00ms
消息名:wtask.completecondi 请求次数:297 耗时最小:23 ms 耗时最大:517 ms 平均耗时:63.37ms 中位耗时:39.00ms
消息名:wtask.finish 请求次数:792 耗时最小:34 ms 耗时最大:777 ms 平均耗时:174.03ms 中位耗时:142.00ms
消息名:practice.info 请求次数:99 耗时最小:19 ms 耗时最大:473 ms 平均耗时:57.72ms 中位耗时:36.00ms
消息名:hero.talentlist 请求次数:99 耗时最小:18 ms 耗时最大:66 ms 平均耗时:27.80ms 中位耗时:26.00ms
消息名:wtask.accept 请求次数:940 耗时最小:21 ms 耗时最大:314 ms 平均耗时:78.23ms 中位耗时:75.00ms
消息名:sys.funcactivate 请求次数:297 耗时最小:14 ms 耗时最大:470 ms 平均耗时:24.28ms 中位耗时:21.00ms
消息名:wtask.battlefinish 请求次数:2 耗时最小:5 ms 耗时最大:6 ms 平均耗时:5.50 ms 中位耗时:5.50 ms
消息名:sys.funcgetlist 请求次数:1 耗时最小:2 ms 耗时最大:2 ms 平均耗时:2.00 ms 中位耗时:2.00 ms
消息名:wtask.info 请求次数:1 耗时最小:3 ms 耗时最大:3 ms 平均耗时:3.00 ms 中位耗时:3.00 ms
消息名:wtask.completecondi 请求次数:2 耗时最小:2 ms 耗时最大:4 ms 平均耗时:3.00 ms 中位耗时:3.00 ms
消息名:wtask.battlestart 请求次数:2 耗时最小:3 ms 耗时最大:5 ms 平均耗时:4.00 ms 中位耗时:4.00 ms
消息名:gm.cmd 请求次数:2 耗时最小:0 ms 耗时最大:1 ms 平均耗时:0.50 ms 中位耗时:0.50 ms
消息名:wtask.finish 请求次数:5 耗时最小:6 ms 耗时最大:16 ms 平均耗时:9.40 ms 中位耗时:8.00 ms
消息名:chat.send 请求次数:10 耗时最小:0 ms 耗时最大:3 ms 平均耗时:1.10 ms 中位耗时:1.00 ms
消息名:shop.getlist 请求次数:10 耗时最小:1 ms 耗时最大:12 ms 平均耗时:2.70 ms 中位耗时:2.00 ms
消息名:hero.list 请求次数:1 耗时最小:2 ms 耗时最大:2 ms 平均耗时:2.00 ms 中位耗时:2.00 ms
消息名:hero.talentlist 请求次数:1 耗时最小:1 ms 耗时最大:1 ms 平均耗时:1.00 ms 中位耗时:1.00 ms
消息名:equipment.getlist 请求次数:1 耗时最小:1 ms 耗时最大:1 ms 平均耗时:1.00 ms 中位耗时:1.00 ms
消息名:items.getlist 请求次数:1 耗时最小:1 ms 耗时最大:1 ms 平均耗时:1.00 ms 中位耗时:1.00 ms
消息名:user.login 请求次数:1 耗时最小:827 ms 耗时最大:827 ms 平均耗时:827.00ms 中位耗时:827.00ms
消息名:user.create 请求次数:1 耗时最小:6 ms 耗时最大:6 ms 平均耗时:6.00 ms 中位耗时:6.00 ms
消息名:wtask.accept 请求次数:6 耗时最小:1 ms 耗时最大:4 ms 平均耗时:3.33 ms 中位耗时:4.00 ms

View File

@ -46,6 +46,8 @@ type IModuleRobot interface {
Init() (err error)
//接收到回应和推送消息
Receive(robot IRobot, stype string, message proto.Message) (err error)
//一次执行流
OncePipeline(robot IRobot) (err error)
//执行流水线任务
DoPipeline(robot IRobot) (err error)
//执行任务

View File

@ -36,8 +36,59 @@ func (this *ModuleRobot_Arena) Receive(robot IRobot, stype string, message proto
return
}
func (this *ModuleRobot_Arena) OncePipeline(robot IRobot) (err error) {
var (
errdata *pb.ErrorData
)
if _, errdata = robot.SendMessage("arena", "info", &pb.ArenaInfoReq{}); errdata != nil {
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
return
}
if _, errdata = robot.SendMessage("arena", "matche", &pb.ArenaMatcheReq{}); errdata != nil {
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
return
}
return
}
//机器人执行流
func (this *ModuleRobot_Arena) DoPipeline(robot IRobot) (err error) {
var (
errdata *pb.ErrorData
heromodule *ModuleRobot_Hero
heros []string
player *pb.ArenaPlayer
resp proto.Message
)
heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero)
heros = heromodule.getbattlehero()
for _, v := range this.players {
player = v
break
}
if resp, errdata = robot.SendMessage("arena", "challenge", &pb.ArenaChallengeReq{
Playerid: player.Uid,
Isai: player.Isai,
MformatId: player.Mformatid,
Battle: &pb.BattleFormation{
Format: heros,
}}); errdata != nil {
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
return
}
if _, errdata = robot.SendMessage("arena", "challengeover", &pb.ArenaChallengeRewardReq{
Iswin: true,
Isai: player.Isai,
Aiintegral: player.Integral,
Ainame: player.Name,
Report: &pb.BattleReport{
Info: resp.(*pb.MainlineChallengeResp).Info,
WinSide: 1,
}}); errdata != nil {
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
return
}
return
}

View File

@ -25,6 +25,9 @@ func (this *ModuleRobot_Chat) Receive(robot IRobot, stype string, message proto.
}
return
}
func (this *ModuleRobot_Chat) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_Chat) DoPipeline(robot IRobot) (err error) {

View File

@ -23,6 +23,9 @@ func (this *ModuleRobot_GM) Receive(robot IRobot, stype string, message proto.Me
return
}
func (this *ModuleRobot_GM) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_GM) DoPipeline(robot IRobot) (err error) {

View File

@ -46,6 +46,10 @@ func (this *ModuleRobot_Hero) Receive(robot IRobot, stype string, message proto.
return
}
func (this *ModuleRobot_Hero) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_Hero) DoPipeline(robot IRobot) (err error) {
var (

View File

@ -48,6 +48,9 @@ func (this *ModuleRobot_MainLine) Receive(robot IRobot, stype string, message pr
}
return
}
func (this *ModuleRobot_MainLine) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_MainLine) DoPipeline(robot IRobot) (err error) {

View File

@ -29,6 +29,9 @@ func (this *ModuleRobot_Practice) Receive(robot IRobot, stype string, message pr
}
return
}
func (this *ModuleRobot_Practice) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_Practice) DoPipeline(robot IRobot) (err error) {

View File

@ -30,6 +30,9 @@ func (this *ModuleRobot_Shop) Receive(robot IRobot, stype string, message proto.
}
return
}
func (this *ModuleRobot_Shop) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_Shop) DoPipeline(robot IRobot) (err error) {

View File

@ -33,6 +33,9 @@ func (this *ModuleRobot_User) Receive(robot IRobot, stype string, message proto.
}
return
}
func (this *ModuleRobot_User) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_User) DoPipeline(robot IRobot) (err error) {

View File

@ -34,6 +34,9 @@ func (this *ModuleRobot_Viking) Receive(robot IRobot, stype string, message prot
return
}
func (this *ModuleRobot_Viking) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_Viking) DoPipeline(robot IRobot) (err error) {

View File

@ -84,6 +84,9 @@ func (this *ModuleRobot_WTask) Receive(robot IRobot, stype string, message proto
}
return
}
func (this *ModuleRobot_WTask) OncePipeline(robot IRobot) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_WTask) DoPipeline(robot IRobot) (err error) {