Merge remote-tracking branch 'origin/main' into allmerge

pull/2427/head
withchao 1 year ago
commit 8b32ce7144

@ -101,12 +101,14 @@ func (c *Client) ResetClient(ctx *UserConnContext, conn LongConn, longConnServer
c.subUserIDs = make(map[string]struct{}) c.subUserIDs = make(map[string]struct{})
} }
func (c *Client) pingHandler(_ string) error { func (c *Client) pingHandler(appData string) error {
if err := c.conn.SetReadDeadline(pongWait); err != nil { if err := c.conn.SetReadDeadline(pongWait); err != nil {
return err return err
} }
return c.writePongMsg() log.ZDebug(c.ctx, "ping Handler Success.", "appData", appData)
return c.writePongMsg(appData)
} }
func (c *Client) pongHandler(_ string) error { func (c *Client) pongHandler(_ string) error {
@ -161,7 +163,7 @@ func (c *Client) readMessage() {
return return
case PingMessage: case PingMessage:
err := c.writePongMsg() err := c.writePongMsg("")
log.ZError(c.ctx, "writePongMsg", err) log.ZError(c.ctx, "writePongMsg", err)
case CloseMessage: case CloseMessage:
@ -389,7 +391,7 @@ func (c *Client) writePingMsg() error {
return c.conn.WriteMessage(PingMessage, nil) return c.conn.WriteMessage(PingMessage, nil)
} }
func (c *Client) writePongMsg() error { func (c *Client) writePongMsg(appData string) error {
if c.closed.Load() { if c.closed.Load() {
return nil return nil
} }
@ -402,5 +404,5 @@ func (c *Client) writePongMsg() error {
return err return err
} }
return c.conn.WriteMessage(PongMessage, nil) return c.conn.WriteMessage(PongMessage, []byte(appData))
} }

@ -63,7 +63,7 @@ func (s *seqConversationCacheRedis) batchGetMaxSeq(ctx context.Context, keys []s
for i, key := range keys { for i, key := range keys {
result[i] = pipe.HGet(ctx, key, "CURR") result[i] = pipe.HGet(ctx, key, "CURR")
} }
if _, err := pipe.Exec(ctx); err != nil { if _, err := pipe.Exec(ctx); err != nil && !errors.Is(err, redis.Nil) {
return errs.Wrap(err) return errs.Wrap(err)
} }
var notFoundKey []string var notFoundKey []string

@ -116,7 +116,7 @@ func Main(conf string, del time.Duration) error {
{ {
Prefix: MaxSeq, Prefix: MaxSeq,
GetSeq: cSeq.GetMaxSeq, GetSeq: cSeq.GetMaxSeq,
SetSeq: cSeq.SetMinSeq, SetSeq: cSeq.SetMaxSeq,
}, },
{ {
Prefix: MinSeq, Prefix: MinSeq,

Loading…
Cancel
Save