优化启动流程整理代码

This commit is contained in:
boyce
2020-07-31 20:04:49 +08:00
parent 5e3cb7623f
commit 0d547b1e83
4 changed files with 20 additions and 26 deletions

View File

@@ -1,7 +1,5 @@
package service
import "github.com/duanhf2012/origin/log"
//本地所有的service
var mapServiceName map[string]IService
@@ -13,24 +11,18 @@ func Init(chanCloseSig chan bool) {
closeSig=chanCloseSig
for _,s := range mapServiceName {
err := s.OnInit()
if err!=nil {
log.Fatal("start server fail :%+v.....",err)
}
s.OnInit()
}
}
func Setup(s IService) bool {
_,ok := mapServiceName[s.GetName()]
if ok == true {
return false
}
//s.Init(s)
mapServiceName[s.GetName()] = s
return true
}