Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change log and avoid nil array. #728

Merged
merged 10 commits into from
Sep 29, 2024
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