mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-23 13:29:20 +08:00
defer close etcd connection
This commit is contained in:
parent
429ce146f0
commit
1bf061a86e
@ -42,6 +42,7 @@ func UserRegister(c *gin.Context) {
|
||||
log.Info("", "", "api user_register init ....")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.RpcGetTokenName)
|
||||
client := pbAuth.NewAuthClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsUserRegister{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -29,6 +29,7 @@ func UserToken(c *gin.Context) {
|
||||
log.Info("", "", "api user_token init ....")
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.RpcGetTokenName)
|
||||
client := pbAuth.NewAuthClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsUserToken{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -21,6 +21,7 @@ func AddBlacklist(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsSearchFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -22,6 +22,7 @@ func AddFriend(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsAddFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -23,6 +23,7 @@ func AddFriendResponse(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsAddFriendResponse{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -22,6 +22,7 @@ func DeleteFriend(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsDeleteFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -32,6 +32,7 @@ func GetBlacklist(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsGetBlackList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -33,6 +33,7 @@ func GetFriendApplyList(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsGetFriendApplyList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -34,6 +34,7 @@ func GetFriendList(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsGetFriendLIst{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -21,6 +21,7 @@ func RemoveBlacklist(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsRemoveBlackList{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -21,6 +21,7 @@ func SearchFriend(c *gin.Context) {
|
||||
log.Info("", "", fmt.Sprintf("api search friend init ...."))
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsSearchFriend{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -22,6 +22,7 @@ func SetFriendComment(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName)
|
||||
client := pbFriend.NewFriendClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsSetFriendComment{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -27,6 +27,7 @@ func GetUserInfo(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
client := pbUser.NewUserClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsStruct{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
@ -29,6 +29,7 @@ func UpdateUserInfo(c *gin.Context) {
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName)
|
||||
client := pbUser.NewUserClient(etcdConn)
|
||||
defer etcdConn.Close()
|
||||
|
||||
params := paramsStruct{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user