diff --git a/app.go b/app.go index daedb74..58f1f73 100644 --- a/app.go +++ b/app.go @@ -25,6 +25,8 @@ type App_ struct { chGoLoopWait chan int64 nowTime time.Time imMsgHandlers [1024]func(int16,*q5.XParams) + maxRunDelay int64 + maxScheduleTime int64 } func (this *App_) Init() { @@ -63,6 +65,7 @@ func (this *App_) Init() { this.nodeId, this.instanceId, os.Getpid()) + this.installTimer() go this.goLoopTimer() } @@ -75,9 +78,22 @@ func (this *App_) UnInit() { func (this *App_) Run() { for !this.terminated { this.nowTime = time.Now() + + beginTick := q5.GetTickCount() _Timer.Update() this.dispatchIMMsg() + endTick := q5.GetTickCount() + + if this.maxRunDelay < endTick - beginTick { + this.maxRunDelay = endTick - beginTick + } + this.schedule() + endTick = q5.GetTickCount() + if this.maxScheduleTime < endTick - beginTick { + this.maxScheduleTime = endTick - beginTick + } + } } @@ -177,3 +193,17 @@ func (this *App_) dispatchIMMsg() { } } } + +func (this *App_) installTimer() { + Timer().AddRepeatTimer(1000 * 60, + func (params* q5.XParams) { + + }, + func (params* q5.XParams) { + SysLog().Info("max_run_delay:%d max_schedule_time:%d", + App.maxRunDelay, + App.maxScheduleTime) + App.maxRunDelay = 0 + App.maxScheduleTime = 0 + }) +} diff --git a/tglog.go b/tglog.go index 94326e0..9a03062 100644 --- a/tglog.go +++ b/tglog.go @@ -59,7 +59,7 @@ func (this *TGLog_) AddTrackLogEx( xobj.SetXValue("#account_id", new(q5.XValue).SetString(accountId)) xobj.SetXValue("#type", new(q5.XValue).SetString("track")) xobj.SetXValue("#time", new(q5.XValue).SetString(time.Now().Format("2006-01-02 15:04:05"))) - xobj.SetXValue("#event_name", new(q5.XValue).SetString("eventName")) + xobj.SetXValue("#event_name", new(q5.XValue).SetString(eventName)) xobj.SetXObject("#properties", prop)