上传日志添加
This commit is contained in:
parent
a70204f3b1
commit
52351439e8
@ -110,7 +110,7 @@ func (this *ParkourComp) join(ctx context.Context, req *pb.RPCParkourJoinMatchRe
|
|||||||
this.total += int32(len(req.Member))
|
this.total += int32(len(req.Member))
|
||||||
this.tlock.Unlock()
|
this.tlock.Unlock()
|
||||||
if this.total >= 6 && atomic.LoadInt32(&this.timerlock) == 1 {
|
if this.total >= 6 && atomic.LoadInt32(&this.timerlock) == 1 {
|
||||||
this.match()
|
go this.match()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -129,8 +129,13 @@ func (this *ParkourComp) match() {
|
|||||||
if !atomic.CompareAndSwapInt32(&this.timerlock, 1, 2) { //正在执行,就不要在进来了
|
if !atomic.CompareAndSwapInt32(&this.timerlock, 1, 2) { //正在执行,就不要在进来了
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
startime := time.Now()
|
||||||
defer atomic.StoreInt32(&this.timerlock, 1) //执行完毕释放
|
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)
|
// this.module.Errorf("捕羊大赛 定时匹配,%d", this.total)
|
||||||
if this.total == 0 {
|
if this.total == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user