mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-24 23:09:40 +08:00
优化数据库模块空闲时占有过多cpu
This commit is contained in:
@@ -23,9 +23,9 @@ type CExitCtl struct {
|
|||||||
|
|
||||||
type COriginNode struct {
|
type COriginNode struct {
|
||||||
CExitCtl
|
CExitCtl
|
||||||
serviceManager service.IServiceManager
|
serviceManager service.IServiceManager
|
||||||
sigs chan os.Signal
|
sigs chan os.Signal
|
||||||
debugCheck bool
|
debugListenAddress string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *COriginNode) Init() {
|
func (s *COriginNode) Init() {
|
||||||
@@ -38,8 +38,9 @@ func (s *COriginNode) Init() {
|
|||||||
signal.Notify(s.sigs, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(s.sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *COriginNode) OpenDebugCheck() {
|
// OpenDebugCheck ("localhost:6060")...http://localhost:6060/
|
||||||
s.debugCheck = true
|
func (s *COriginNode) OpenDebugCheck(listenAddress string) {
|
||||||
|
s.debugListenAddress = listenAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *COriginNode) SetupService(services ...service.IService) {
|
func (s *COriginNode) SetupService(services ...service.IService) {
|
||||||
@@ -71,10 +72,10 @@ func (s *COriginNode) SetupService(services ...service.IService) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *COriginNode) Start() {
|
func (s *COriginNode) Start() {
|
||||||
if s.debugCheck == true {
|
if s.debugListenAddress != "" {
|
||||||
go func() {
|
go func() {
|
||||||
|
|
||||||
log.Println(http.ListenAndServe("localhost:6060", nil))
|
log.Println(http.ListenAndServe(s.debugListenAddress, nil))
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -305,7 +305,6 @@ func (slf *BaseModule) RunModule(module IModule) error {
|
|||||||
GetLogger().Printf(LEVER_WARN, "stopping module %s...", fmt.Sprintf("%T", slf))
|
GetLogger().Printf(LEVER_WARN, "stopping module %s...", fmt.Sprintf("%T", slf))
|
||||||
fmt.Println("stopping module %s...", fmt.Sprintf("%T", slf))
|
fmt.Println("stopping module %s...", fmt.Sprintf("%T", slf))
|
||||||
return nil
|
return nil
|
||||||
default:
|
|
||||||
}
|
}
|
||||||
if module.OnRun() == false {
|
if module.OnRun() == false {
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ func (slf *CServiceManager) CheckServiceTimeTimeout(exit chan bool, pwaitGroup *
|
|||||||
case <-exit:
|
case <-exit:
|
||||||
fmt.Println("CheckServiceTimeTimeout stopping...")
|
fmt.Println("CheckServiceTimeTimeout stopping...")
|
||||||
return
|
return
|
||||||
default:
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range slf.localserviceMap {
|
for _, s := range slf.localserviceMap {
|
||||||
|
|||||||
@@ -360,7 +360,6 @@ func (slf *DBModule) RunExecuteDBCoroutine() {
|
|||||||
return
|
return
|
||||||
case fun := <-slf.syncExecuteFun:
|
case fun := <-slf.syncExecuteFun:
|
||||||
fun()
|
fun()
|
||||||
default:
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user