1
This commit is contained in:
parent
dfb742786b
commit
15ca2fef81
30
app.go
30
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
|
||||
})
|
||||
}
|
||||
|
2
tglog.go
2
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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user