This commit is contained in:
wangchuxiao
2023-03-08 13:34:12 +08:00
parent 107f4c950b
commit f8ad35a6f7
24 changed files with 209 additions and 125 deletions
+3
View File
@@ -37,6 +37,8 @@ func Init(rpcPort, wsPort int) {
}
func Run(prometheusPort int) {
var wg sync.WaitGroup
wg.Add(3)
go ws.run()
go rpcSvr.run()
go func() {
@@ -45,4 +47,5 @@ func Run(prometheusPort int) {
panic(err)
}
}()
wg.Wait()
}
+4
View File
@@ -9,6 +9,7 @@ import (
"OpenIM/pkg/common/db/unrelation"
"OpenIM/pkg/common/prome"
"fmt"
"sync"
)
type MsgTransfer struct {
@@ -64,6 +65,8 @@ func (m *MsgTransfer) initPrometheus() {
}
func (m *MsgTransfer) Start(prometheusPort int) error {
var wg sync.WaitGroup
wg.Add(4)
if config.Config.ChatPersistenceMysql {
go m.persistentCH.persistentConsumerGroup.RegisterHandleAndConsumer(m.persistentCH)
} else {
@@ -76,5 +79,6 @@ func (m *MsgTransfer) Start(prometheusPort int) error {
if err != nil {
return err
}
wg.Wait()
return nil
}
+1 -1
View File
@@ -20,7 +20,7 @@ func start(rpcPort int, rpcRegisterName string, prometheusPorts int, rpcFn func(
flagRpcPort := flag.Int("port", rpcPort, "get RpcGroupPort from cmd,default 16000 as port")
flagPrometheusPort := flag.Int("prometheus_port", prometheusPorts, "groupPrometheusPort default listen port")
flag.Parse()
fmt.Println("start group rpc server, port: ", *flagRpcPort, ", OpenIM version: ", constant.CurrentVersion)
fmt.Println("start group rpc server, port: ", *flagRpcPort, ", OpenIM version: ", config.Version)
log.NewPrivateLog(constant.LogFileName)
listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", config.Config.ListenIP, *flagRpcPort))
if err != nil {