优化服务的启停顺序

This commit is contained in:
duanhf2012
2023-02-16 15:59:07 +08:00
parent e326e342f2
commit 0ebbe0e31d
4 changed files with 40 additions and 35 deletions

View File

@@ -19,9 +19,7 @@ func init(){
setupServiceList = []IService{}
}
func Init(chanCloseSig chan bool) {
closeSig=chanCloseSig
func Init() {
for _,s := range setupServiceList {
err := s.OnInit()
if err != nil {
@@ -57,8 +55,8 @@ func Start(){
}
}
func WaitStop(){
func StopAllService(){
for i := len(setupServiceList) - 1; i >= 0; i-- {
setupServiceList[i].Wait()
setupServiceList[i].Stop()
}
}