* fix: minor log typo

* fix: #2895 no need to specify listen port in config file, just use system random

* drop useless code
This commit is contained in:
Morya
2024-12-04 11:18:39 +08:00
committed by GitHub
parent 14477321fd
commit a69d174e86
22 changed files with 198 additions and 67 deletions
+3 -6
View File
@@ -35,16 +35,13 @@ type Config struct {
// Start run ws server.
func Start(ctx context.Context, index int, conf *Config) error {
log.CInfo(ctx, "MSG-GATEWAY server is initializing", "rpcPorts", conf.MsgGateway.RPC.Ports,
log.CInfo(ctx, "MSG-GATEWAY server is initializing",
"wsPort", conf.MsgGateway.LongConnSvr.Ports, "prometheusPorts", conf.MsgGateway.Prometheus.Ports)
wsPort, err := datautil.GetElemByIndex(conf.MsgGateway.LongConnSvr.Ports, index)
if err != nil {
return err
}
rpcPort, err := datautil.GetElemByIndex(conf.MsgGateway.RPC.Ports, index)
if err != nil {
return err
}
rdb, err := redisutil.NewRedisClient(ctx, conf.RedisConfig.Build())
if err != nil {
return err
@@ -57,7 +54,7 @@ func Start(ctx context.Context, index int, conf *Config) error {
WithMessageMaxMsgLength(conf.MsgGateway.LongConnSvr.WebsocketMaxMsgLen),
)
hubServer := NewServer(rpcPort, longServer, conf, func(srv *Server) error {
hubServer := NewServer(longServer, conf, func(srv *Server) error {
longServer.online, _ = rpccache.NewOnlineCache(srv.userRcp, nil, rdb, false, longServer.subscriberUserOnlineStatusChanges)
return nil
})