makelint internal/ (#1951)

Signed-off-by: xuan <146319162+wxuanF@users.noreply.github.com>
pull/1956/head
xuan 9 months ago committed by GitHub
parent 3c1d096e99
commit b13f2614b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -78,16 +78,17 @@ type Client struct {
token string
}
func newClient(ctx *UserConnContext, conn LongConn, isCompress bool) *Client {
return &Client{
w: new(sync.Mutex),
conn: conn,
PlatformID: utils.StringToInt(ctx.GetPlatformID()),
IsCompress: isCompress,
UserID: ctx.GetUserID(),
ctx: ctx,
}
}
// function not used
// func newClient(ctx *UserConnContext, conn LongConn, isCompress bool) *Client {
// return &Client{
// w: new(sync.Mutex),
// conn: conn,
// PlatformID: utils.StringToInt(ctx.GetPlatformID()),
// IsCompress: isCompress,
// UserID: ctx.GetUserID(),
// ctx: ctx,
// }
// }
// ResetClient updates the client's state with new connection and context information.
func (c *Client) ResetClient(

@ -108,10 +108,12 @@ func (d *GWebSocket) Dial(urlStr string, requestHeader http.Header) (*http.Respo
}
func (d *GWebSocket) IsNil() bool {
if d.conn != nil {
return false
}
return true
return d.conn == nil
//
// if d.conn != nil {
// return false
// }
// return true
}
func (d *GWebSocket) SetConnNil() {

@ -61,11 +61,12 @@ type LongConnServer interface {
MessageHandler
}
var bufferPool = sync.Pool{
New: func() any {
return make([]byte, 1024)
},
}
// bufferPool is unused
// var bufferPool = sync.Pool{
// New: func() any {
// return make([]byte, 1024)
// },
// }
type WsServer struct {
port int

@ -58,12 +58,12 @@ func (u *UserMap) Get(key string, platformID int) ([]*Client, bool, bool) {
func (u *UserMap) Set(key string, v *Client) {
allClients, existed := u.m.Load(key)
if existed {
log.ZDebug(context.Background(), "Set existed", "user_id", key, "client", *v)
log.ZDebug(context.Background(), "Set existed", "user_id", key, "client_user_id", v.UserID)
oldClients := allClients.([]*Client)
oldClients = append(oldClients, v)
u.m.Store(key, oldClients)
} else {
log.ZDebug(context.Background(), "Set not existed", "user_id", key, "client", *v)
log.ZDebug(context.Background(), "Set not existed", "user_id", key, "client_user_id", v.UserID)
var clients []*Client
clients = append(clients, v)
u.m.Store(key, clients)

@ -71,7 +71,7 @@ func StartTransfer(prometheusPort int) error {
return err
}
if err := client.CreateRpcRootNodes(config.Config.GetServiceNames()); err != nil {
if err2 := client.CreateRpcRootNodes(config.Config.GetServiceNames()); err2 != nil {
return err
}
client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, "round_robin")))

@ -74,10 +74,10 @@ type OnlineHistoryRedisConsumerHandler struct {
chArrays [ChannelNum]chan Cmd2Value
msgDistributionCh chan Cmd2Value
singleMsgSuccessCount uint64
singleMsgFailedCount uint64
singleMsgSuccessCountMutex sync.Mutex
singleMsgFailedCountMutex sync.Mutex
// singleMsgSuccessCount uint64
// singleMsgFailedCount uint64
// singleMsgSuccessCountMutex sync.Mutex
// singleMsgFailedCountMutex sync.Mutex
msgDatabase controller.CommonMsgDatabase
conversationRpcClient *rpcclient.ConversationRpcClient
@ -111,9 +111,7 @@ func NewOnlineHistoryRedisConsumerHandler(
}
func (och *OnlineHistoryRedisConsumerHandler) Run(channelID int) {
for {
select {
case cmd := <-och.chArrays[channelID]:
for cmd := range och.chArrays[channelID] {
switch cmd.Cmd {
case SourceMessages:
msgChannelValue := cmd.Value.(MsgChannelValue)
@ -170,7 +168,6 @@ func (och *OnlineHistoryRedisConsumerHandler) Run(channelID int) {
}
}
}
}
// 获取消息/通知 存储的消息列表, 不存储并且推送的消息列表,.
func (och *OnlineHistoryRedisConsumerHandler) getPushStorageMsgList(

Loading…
Cancel
Save