internalQueryOne select count... add tmp table flag
This commit is contained in:
parent
0391e1a006
commit
0463bb48fc
64
app.go
64
app.go
@ -2,11 +2,11 @@ package f5
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"q5"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
"os"
|
||||
"q5"
|
||||
)
|
||||
|
||||
type App interface {
|
||||
@ -22,7 +22,7 @@ type App interface {
|
||||
GetNowSeconds() int64
|
||||
GetNowMillis() int64
|
||||
GetNowNano() int64
|
||||
RegisterMainThreadCb(func ())
|
||||
RegisterMainThreadCb(func())
|
||||
}
|
||||
|
||||
type UserApp interface {
|
||||
@ -33,27 +33,27 @@ type UserApp interface {
|
||||
}
|
||||
|
||||
type app struct {
|
||||
zoneId int32
|
||||
nodeId int32
|
||||
instanceId int32
|
||||
terminated bool
|
||||
flags map[int32]int32
|
||||
servicing bool
|
||||
contextHash map[int32]q5.Args
|
||||
loopCond *sync.Cond
|
||||
imTopNode *IMMsgNode
|
||||
imBotNode *IMMsgNode
|
||||
imWorkNode *IMMsgNode
|
||||
imMsgMutex sync.RWMutex
|
||||
zoneId int32
|
||||
nodeId int32
|
||||
instanceId int32
|
||||
terminated bool
|
||||
flags map[int32]int32
|
||||
servicing bool
|
||||
contextHash map[int32]q5.Args
|
||||
loopCond *sync.Cond
|
||||
imTopNode *IMMsgNode
|
||||
imBotNode *IMMsgNode
|
||||
imWorkNode *IMMsgNode
|
||||
imMsgMutex sync.RWMutex
|
||||
chGoLoopTimerExit chan int
|
||||
chGoLoopWait chan int64
|
||||
nowTime time.Time
|
||||
nowUnixNano int64
|
||||
imMsgHandlers [1024]func(q5.Args)
|
||||
maxRunDelay int64
|
||||
maxScheduleTime int64
|
||||
uuid q5.Uuid
|
||||
userApp UserApp
|
||||
chGoLoopWait chan int64
|
||||
nowTime time.Time
|
||||
nowUnixNano int64
|
||||
imMsgHandlers [1024]func(q5.Args)
|
||||
maxRunDelay int64
|
||||
maxScheduleTime int64
|
||||
uuid q5.Uuid
|
||||
userApp UserApp
|
||||
}
|
||||
|
||||
func (this *app) init(userApp UserApp) {
|
||||
@ -82,14 +82,14 @@ func (this *app) init(userApp UserApp) {
|
||||
this.nodeId = int32(tmpNodeId)
|
||||
this.instanceId = int32(tmpInstanceId)
|
||||
}
|
||||
this.uuid.SetMachineId((this.nodeId - 1) * MAX_NODE_ID + this.instanceId)
|
||||
this.uuid.SetMachineId((this.nodeId-1)*MAX_NODE_ID + this.instanceId)
|
||||
this.loopCond = sync.NewCond(new(sync.Mutex))
|
||||
this.chGoLoopTimerExit = make(chan int)
|
||||
this.chGoLoopWait = make(chan int64)
|
||||
_app.RegisterIMMsgHandle(
|
||||
IM_EXEC_MAIN_THREAD_CB,
|
||||
func (args q5.Args) {
|
||||
cb := args[0].(func ())
|
||||
func(args q5.Args) {
|
||||
cb := args[0].(func())
|
||||
cb()
|
||||
})
|
||||
this.outputRuningLog()
|
||||
@ -125,7 +125,7 @@ func (this *app) run() {
|
||||
this.schedule()
|
||||
endTick := q5.GetTickCount()
|
||||
|
||||
if this.maxRunDelay < endTick - beginTick {
|
||||
if this.maxRunDelay < endTick-beginTick {
|
||||
this.maxRunDelay = endTick - beginTick
|
||||
}
|
||||
}
|
||||
@ -178,10 +178,10 @@ func (this *app) RegisterIMMsgHandle(msgId uint16, handle func(q5.Args)) {
|
||||
this.imMsgHandlers[msgId] = handle
|
||||
}
|
||||
|
||||
func (this *app) RegisterMainThreadCb(cb func ()) {
|
||||
func (this *app) RegisterMainThreadCb(cb func()) {
|
||||
_app.AddIMMsg(IM_EXEC_MAIN_THREAD_CB,
|
||||
[]interface{} {
|
||||
cb,
|
||||
[]interface{}{
|
||||
cb,
|
||||
})
|
||||
}
|
||||
|
||||
@ -245,8 +245,8 @@ func (this *app) dispatchIMMsg() {
|
||||
}
|
||||
|
||||
func (this *app) installTimer() {
|
||||
GetTimer().SetInterval(1000 * 60,
|
||||
func (ev int32, params *q5.Args) {
|
||||
GetTimer().SetInterval(1000*60,
|
||||
func(ev int32, params *q5.Args) {
|
||||
if ev == q5.TIMER_EXEC_EVENT {
|
||||
GetSysLog().Info("max_run_delay:%d max_schedule_time:%d",
|
||||
_app.maxRunDelay,
|
||||
|
Loading…
x
Reference in New Issue
Block a user