上传日志添加

This commit is contained in:
liwei1dao 2023-05-17 17:00:35 +08:00
parent a70204f3b1
commit 52351439e8

View File

@ -110,7 +110,7 @@ func (this *ParkourComp) join(ctx context.Context, req *pb.RPCParkourJoinMatchRe
this.total += int32(len(req.Member))
this.tlock.Unlock()
if this.total >= 6 && atomic.LoadInt32(&this.timerlock) == 1 {
this.match()
go this.match()
}
return
}
@ -129,8 +129,13 @@ func (this *ParkourComp) match() {
if !atomic.CompareAndSwapInt32(&this.timerlock, 1, 2) { //正在执行,就不要在进来了
return
}
defer atomic.StoreInt32(&this.timerlock, 1) //执行完毕释放
startime := time.Now()
defer func() {
atomic.StoreInt32(&this.timerlock, 1) //执行完毕释放
log.Debug("Parkour Match",
log.Field{Key: "t", Value: time.Since(startime).Milliseconds()},
)
}()
// this.module.Errorf("捕羊大赛 定时匹配,%d", this.total)
if this.total == 0 {