Skip to content

Commit

Permalink
refactor: change log and avoid nil array. (#728)
Browse files Browse the repository at this point in the history
* fix: remove some code to avoid creating group errors..

Signed-off-by: Gordon <[email protected]>

* fix: find message add local Ex.

Signed-off-by: Gordon <[email protected]>

* fix: notification conversation update.

Signed-off-by: Gordon <[email protected]>

* fix: unread num is negative and optimization of sync conversation when app login or re conn.

Signed-off-by: Gordon <[email protected]>

* fix: update logs add ex filed and remove set self userinfo with ex.

Signed-off-by: Gordon <[email protected]>

* refactor: change log and avoid nil array.

Signed-off-by: Gordon <[email protected]>

---------

Signed-off-by: Gordon <[email protected]>
  • Loading branch information
FGadvancer authored Sep 29, 2024
1 parent 1aa0bee commit 05b3084
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 align="center" style="border-bottom: none">
<b>
<a href="https://doc.rentsoft.cn/">openim-sdk-core</a><br>
<a href="https://doc.rentsoft.cn/sdks/introduction">openim-sdk-core</a><br>
</b>
</h1>
<h3 align="center" style="border-bottom: none">
Expand Down
2 changes: 1 addition & 1 deletion internal/conversation_msg/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ func (c *Conversation) SendMessage(ctx context.Context, s *sdk_struct.MsgStruct,
sourcePath = utils.FileTmpPath(s.PictureElem.SourcePath, c.DataDir)
delFile = append(delFile, sourcePath)
}
// log.Info("", "file", sourcePath, delFile)
log.ZDebug(ctx, "send picture", "path", sourcePath)

res, err := c.file.UploadFile(ctx, &file.UploadFileReq{
Expand Down Expand Up @@ -833,6 +832,7 @@ func (c *Conversation) MarkConversationMessageAsRead(ctx context.Context, conver
return c.markConversationMessageAsRead(ctx, conversationID)
}

// deprecated
func (c *Conversation) MarkMessagesAsReadByMsgID(ctx context.Context, conversationID string, clientMsgIDs []string) error {
return c.markMessagesAsReadByMsgID(ctx, conversationID, clientMsgIDs)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/conversation_msg/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (c *Conversation) doUpdateConversation(c2v common.Cmd2Value) {
}
ctx := c2v.Ctx
node := c2v.Value.(common.UpdateConNode)
log.ZInfo(ctx, "doUpdateConversation", "node", node)
log.ZInfo(ctx, "doUpdateConversation", "node", node, "cmd", c2v.Cmd, "caller", c2v.Caller)
switch node.Action {
case constant.AddConOrUpLatMsg:
var list []*model_struct.LocalConversation
Expand Down
4 changes: 2 additions & 2 deletions pkg/common/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package common
import (
"context"
"fmt"
"github.com/openimsdk/tools/log"
"runtime"
"runtime/debug"
"strings"
"time"

"github.com/openimsdk/tools/log"
)

var packet string
Expand All @@ -34,7 +35,6 @@ func sendCmd(ch chan<- Cmd2Value, value Cmd2Value, timeout time.Duration) error
if value.Caller == "" {
value.Caller = GetCaller(3)
}
log.ZDebug(value.Ctx, "sendCmd chan success", "caller", value.Caller, "cmd", value.Cmd, "value", value.Value)
if ch == nil {
log.ZError(value.Ctx, "sendCmd chan is nil", ErrChanNil, "caller", value.Caller, "cmd", value.Cmd, "value", value.Value)
return ErrChanNil
Expand Down
3 changes: 3 additions & 0 deletions pkg/datafetcher/datafetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ func (ds *DataFetcher[T]) sortByUserIDs(data []T, userIDs []string) []T {

// FetchMissingAndCombineLocal fetches missing data from the server and combines it with local data without inserting it into the local database
func (ds *DataFetcher[T]) FetchMissingAndCombineLocal(ctx context.Context, uids []string) ([]T, error) {
if len(uids) == 0 {
return nil, nil
}
localData, needServer, err := ds.FetchFromLocal(ctx, uids)
if err != nil {
return nil, err
Expand Down

0 comments on commit 05b3084

Please sign in to comment.