mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
errcode
This commit is contained in:
parent
5d7809624c
commit
79c30fdc69
@ -1,4 +1,4 @@
|
||||
package rpc_server
|
||||
package rpcserver
|
||||
|
||||
import (
|
||||
"Open_IM/internal/common/network"
|
||||
@ -31,12 +31,11 @@ func NewRpcServer(registerIPInConfig string, port int, registerName string, zkSe
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = zkClient.Register(s.RegisterName, registerIP, s.Port)
|
||||
s.RegisterCenter = zkClient
|
||||
err = s.RegisterCenter.Register(s.RegisterName, registerIP, s.Port)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.RegisterCenter = zkClient
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func NewRpcAuthServer(port int) *rpcAuth {
|
||||
r, err := rpc_server.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImAuthName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema)
|
||||
r, err := rpcserver.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImAuthName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -35,7 +35,7 @@ func NewRpcAuthServer(port int) *rpcAuth {
|
||||
func (s *rpcAuth) Run() {
|
||||
operationID := utils.OperationIDGenerator()
|
||||
log.NewInfo(operationID, "rpc auth start...")
|
||||
listener, address, err := rpc_server.GetTcpListen(config.Config.ListenIP, s.Port)
|
||||
listener, address, err := rpcserver.GetTcpListen(config.Config.ListenIP, s.Port)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -141,6 +141,6 @@ func (s *rpcAuth) forceKickOff(ctx context.Context, userID string, platformID in
|
||||
}
|
||||
|
||||
type rpcAuth struct {
|
||||
*rpc_server.RpcServer
|
||||
*rpcserver.RpcServer
|
||||
controller.AuthInterface
|
||||
}
|
||||
|
@ -23,14 +23,14 @@ import (
|
||||
)
|
||||
|
||||
type friendServer struct {
|
||||
*rpc_server.RpcServer
|
||||
*rpcserver.RpcServer
|
||||
|
||||
controller.FriendInterface
|
||||
controller.BlackInterface
|
||||
}
|
||||
|
||||
func NewFriendServer(port int) *friendServer {
|
||||
r, err := rpc_server.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImFriendName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema)
|
||||
r, err := rpcserver.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImFriendName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -64,7 +64,7 @@ func NewFriendServer(port int) *friendServer {
|
||||
func (s *friendServer) Run() {
|
||||
operationID := utils.OperationIDGenerator()
|
||||
log.NewInfo(operationID, "friendServer run...")
|
||||
listener, address, err := rpc_server.GetTcpListen(config.Config.ListenIP, s.Port)
|
||||
listener, address, err := rpcserver.GetTcpListen(config.Config.ListenIP, s.Port)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -25,12 +25,12 @@ import (
|
||||
type userServer struct {
|
||||
rpcPort int
|
||||
rpcRegisterName string
|
||||
*rpc_server.RpcServer
|
||||
*rpcserver.RpcServer
|
||||
controller.UserInterface
|
||||
}
|
||||
|
||||
func NewUserServer(port int) *userServer {
|
||||
r, err := rpc_server.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImUserName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema)
|
||||
r, err := rpcserver.NewRpcServer(config.Config.RpcRegisterIP, port, config.Config.RpcRegisterName.OpenImUserName, config.Config.Zookeeper.ZkAddr, config.Config.Zookeeper.Schema)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -52,7 +52,7 @@ func NewUserServer(port int) *userServer {
|
||||
func (s *userServer) Run() {
|
||||
operationID := utils.OperationIDGenerator()
|
||||
log.NewInfo(operationID, "rpc user start...")
|
||||
listener, address, err := rpc_server.GetTcpListen(config.Config.ListenIP, s.Port)
|
||||
listener, address, err := rpcserver.GetTcpListen(config.Config.ListenIP, s.Port)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ func (g *GroupDataBase) MapGroupMemberUserID(ctx context.Context, groupIDs []str
|
||||
mapGroupUserIDs, err := g.groupMemberDB.FindJoinUserID(ctx, groupIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} // 批量cache
|
||||
res := make(map[string]*GroupSimpleUserID)
|
||||
for _, groupID := range groupIDs {
|
||||
users := &GroupSimpleUserID{
|
||||
|
1
pkg/common/db/controller/msg.go
Normal file
1
pkg/common/db/controller/msg.go
Normal file
@ -0,0 +1 @@
|
||||
package controller
|
@ -150,3 +150,12 @@ func MongoTransaction(ctx context.Context, mgo *mongo.Client, fn func(ctx mongo.
|
||||
}
|
||||
return utils.Wrap(sess.CommitTransaction(sCtx), "")
|
||||
}
|
||||
|
||||
func getTxCtx(ctx context.Context, tx []any) context.Context {
|
||||
if len(tx) > 0 {
|
||||
if ctx, ok := tx[0].(mongo.SessionContext); ok {
|
||||
return ctx
|
||||
}
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
@ -111,15 +111,6 @@ type SuperGroupMongoDriver struct {
|
||||
// panic("implement me")
|
||||
// }
|
||||
|
||||
func (s *SuperGroupMongoDriver) getTxCtx(ctx context.Context, tx []any) context.Context {
|
||||
if len(tx) > 0 {
|
||||
if ctx, ok := tx[0].(mongo.SessionContext); ok {
|
||||
return ctx
|
||||
}
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
//func (s *SuperGroupMongoDriver) Transaction(ctx context.Context, fn func(ctx mongo.SessionContext) error) error {
|
||||
// sess, err := s.MgoClient.StartSession()
|
||||
// if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user