Skip to content

Commit ba04362

Browse files
authored
refactor: fix error handling in SendMessage function (#704)
1 parent c8dac40 commit ba04362

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

internal/conversation_msg/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ func (c *Conversation) SendMessage(ctx context.Context, s *sdk_struct.MsgStruct,
504504
if err != nil {
505505
c.updateMsgStatusAndTriggerConversation(ctx, s.ClientMsgID, "", s.CreateTime, constant.MsgStatusSendFailed, s, lc, isOnlineOnly)
506506
putErrs = err
507+
return
507508
}
508509
if res != nil {
509510
s.VideoElem.VideoURL = res.URL

pkg/constant/constant.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ const (
6565
CustomMsgNotTriggerConversation = 119
6666
CustomMsgOnlineOnly = 120
6767

68+
NotificationBegin = 1000
69+
6870
FriendNotificationBegin = 1200
6971

7072
FriendApplicationApprovedNotification = 1201 //add_friend_response
@@ -124,6 +126,7 @@ const (
124126

125127
HasReadReceipt = 2200
126128

129+
NotificationEnd = 5000
127130
////////////////////////////////////////
128131

129132
//MsgFrom

pkg/db/conversation_model.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ func (d *DataBase) GetConversationListSplitDB(ctx context.Context, offset, count
9595
d.mRWMutex.RLock()
9696
defer d.mRWMutex.RUnlock()
9797
var conversationList []*model_struct.LocalConversation
98-
return conversationList, errs.WrapMsg(d.conn.WithContext(ctx).Where("latest_msg_send_time > ?", 0).Order("case when is_pinned=1 then 0 else 1 end,max(latest_msg_send_time,draft_text_time) DESC").Offset(offset).Limit(count).Find(&conversationList).Error,
99-
"GetFriendList failed")
98+
return conversationList, errs.Wrap(d.conn.WithContext(ctx).Where("latest_msg_send_time > ?", 0).Order("case when is_pinned=1 then 0 else 1 end,max(latest_msg_send_time,draft_text_time) DESC").Offset(offset).Limit(count).Find(&conversationList).Error)
10099
}
101100

102101
func (d *DataBase) BatchInsertConversationList(ctx context.Context, conversationList []*model_struct.LocalConversation) error {

0 commit comments

Comments
 (0)