From 6deeccc865bb28d97906cc0f4892b9042563e420 Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Fri, 8 Sep 2023 20:05:39 +0800 Subject: [PATCH] test: for pressure test. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> --- internal/msggateway/client.go | 1 + pkg/common/db/cache/conversation.go | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/internal/msggateway/client.go b/internal/msggateway/client.go index 8121535ad..96e4b02c6 100644 --- a/internal/msggateway/client.go +++ b/internal/msggateway/client.go @@ -126,6 +126,7 @@ func (c *Client) readMessage() { for { messageType, message, returnErr := c.conn.ReadMessage() if returnErr != nil { + log.ZWarn(c.ctx, "readMessage", returnErr, "messageType", messageType) c.closedErr = returnErr return } diff --git a/pkg/common/db/cache/conversation.go b/pkg/common/db/cache/conversation.go index d02b021e3..28140fa3a 100644 --- a/pkg/common/db/cache/conversation.go +++ b/pkg/common/db/cache/conversation.go @@ -58,11 +58,8 @@ type ConversationCache interface { DelConversations(ownerUserID string, conversationIDs ...string) ConversationCache DelUsersConversation(conversationID string, ownerUserIDs ...string) ConversationCache // get one conversation from msgCache - GetConversations( - ctx context.Context, - ownerUserID string, - conversationIDs []string, - ) ([]*relationtb.ConversationModel, error) + GetConversations(ctx context.Context, ownerUserID string, + conversationIDs []string) ([]*relationtb.ConversationModel, error) // get one user's all conversations from msgCache GetUserAllConversations(ctx context.Context, ownerUserID string) ([]*relationtb.ConversationModel, error) // get user conversation recv msg from msgCache @@ -78,10 +75,8 @@ type ConversationCache interface { GetUserAllHasReadSeqs(ctx context.Context, ownerUserID string) (map[string]int64, error) DelUserAllHasReadSeqs(ownerUserID string, conversationIDs ...string) ConversationCache - GetConversationsByConversationID( - ctx context.Context, - conversationIDs []string, - ) ([]*relationtb.ConversationModel, error) + GetConversationsByConversationID(ctx context.Context, + conversationIDs []string) ([]*relationtb.ConversationModel, error) DelConversationByConversationID(conversationIDs ...string) ConversationCache } @@ -411,10 +406,8 @@ func (c *ConversationRedisCache) GetUserAllHasReadSeqs( ) } -func (c *ConversationRedisCache) DelUserAllHasReadSeqs( - ownerUserID string, - conversationIDs ...string, -) ConversationCache { +func (c *ConversationRedisCache) DelUserAllHasReadSeqs(ownerUserID string, + conversationIDs ...string) ConversationCache { cache := c.NewCache() for _, conversationID := range conversationIDs { cache.AddKeys(c.getConversationHasReadSeqKey(ownerUserID, conversationID))