This commit is contained in:
aozhiwei 2024-03-11 20:09:47 +08:00
parent feae034d36
commit 803c5d7912

6
app.go
View File

@ -49,6 +49,7 @@ type UserApp interface {
} }
type app struct { type app struct {
pid int
zoneId int32 zoneId int32
nodeId int32 nodeId int32
instanceId int32 instanceId int32
@ -82,6 +83,7 @@ type app struct {
func (this *app) init(userApp UserApp) { func (this *app) init(userApp UserApp) {
this.userApp = userApp this.userApp = userApp
this.nowTime = time.Now() this.nowTime = time.Now()
this.pid = os.Getpid()
this.ormDbHash = make(map[string]*gorm.DB) this.ormDbHash = make(map[string]*gorm.DB)
this.SetTimeOffset(0) this.SetTimeOffset(0)
atomic.StoreInt64(&this.nowUnixNano, this.nowTime.UnixNano()) atomic.StoreInt64(&this.nowUnixNano, this.nowTime.UnixNano())
@ -118,7 +120,7 @@ func (this *app) init(userApp UserApp) {
GetSysLog().Info("node_id:%d instance_id:%d pid:%d", GetSysLog().Info("node_id:%d instance_id:%d pid:%d",
this.nodeId, this.nodeId,
this.instanceId, this.instanceId,
os.Getpid()) this.pid)
this.installTimer() this.installTimer()
go this.goLoopTimer() go this.goLoopTimer()
this.ginEngine = gin.New() this.ginEngine = gin.New()
@ -374,7 +376,7 @@ func (this *app) getCaHandle(handleName string) GinHandlerFunc {
} }
func (this *app) GetPid() int { func (this *app) GetPid() int {
return os.Getpid() return this.pid
} }
func parseArgs() (int, int) { func parseArgs() (int, int) {