Skip to content

Commit dfe5aed

Browse files
authoredNov 22, 2024··
Merge pull request #791 from openimsdk/cherry-pick-97f3e6d
deps: Merge #782 #784 #788 #789 PRs into pre-release-v3.8.2
2 parents 93891b2 + f8e07fe commit dfe5aed

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed
 

‎.github/workflows/merge-from-milestone.yml

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ on:
1717
required: true
1818
default: 'pre-release-v3.8.2'
1919

20-
schedule:
21-
- cron: '0 2 * * 0'
22-
2320
env:
2421
MILESTONE_NAME: ${{ github.event.inputs.milestone_name || 'v3.8.2' }}
2522
TARGET_BRANCH: ${{ github.event.inputs.target_branch || 'pre-release-v3.8.2' }}

‎internal/conversation_msg/api.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"sync"
1212
"time"
1313

14+
pconstant "github.com/openimsdk/protocol/constant"
15+
1416
"github.com/openimsdk/tools/errs"
1517

1618
"github.com/openimsdk/openim-sdk-core/v3/internal/third/file"
@@ -478,11 +480,18 @@ func (c *Conversation) SendMessage(ctx context.Context, s *sdk_struct.MsgStruct,
478480
name = fmt.Sprintf("msg_file_%s.unknown", s.ClientMsgID)
479481
}
480482

481-
delFile = append(delFile, s.FileElem.FilePath)
483+
var sourcePath string
484+
if utils.FileExist(s.FileElem.FilePath) {
485+
sourcePath = s.FileElem.FilePath
486+
delFile = append(delFile, utils.FileTmpPath(s.FileElem.FilePath, c.DataDir))
487+
} else {
488+
sourcePath = utils.FileTmpPath(s.FileElem.FilePath, c.DataDir)
489+
delFile = append(delFile, sourcePath)
490+
}
482491

483492
res, err := c.file.UploadFile(ctx, &file.UploadFileReq{
484493
ContentType: content_type.GetType(s.FileElem.FileType, filepath.Ext(s.FileElem.FilePath), filepath.Ext(s.FileElem.FileName)),
485-
Filepath: s.FileElem.FilePath,
494+
Filepath: sourcePath,
486495
Uuid: s.FileElem.UUID,
487496
Name: c.fileName("file", s.ClientMsgID) + "/" + filepath.Base(name),
488497
Cause: "msg-file",

‎internal/interaction/msg_sync.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ package interaction
1616

1717
import (
1818
"context"
19+
"errors"
1920
"fmt"
21+
"gorm.io/gorm"
2022
"runtime/debug"
2123
"strings"
2224
"sync"
@@ -91,10 +93,10 @@ func (m *MsgSyncer) loadSeq(ctx context.Context) error {
9193

9294
if len(conversationIDList) == 0 {
9395
version, err := m.db.GetAppSDKVersion(ctx)
94-
if err != nil {
96+
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
9597
return err
9698
}
97-
if !version.Installed {
99+
if version == nil || !version.Installed {
98100
m.reinstalled = true
99101
}
100102
}
@@ -107,16 +109,19 @@ func (m *MsgSyncer) loadSeq(ctx context.Context) error {
107109
Err error
108110
}
109111

110-
concurrency := 20
111-
partSize := len(conversationIDList) / concurrency
112+
partSize := 20
113+
currency := (len(conversationIDList)-1)/partSize + 1
114+
if len(conversationIDList) == 0 {
115+
currency = 0
116+
}
112117
var wg sync.WaitGroup
113-
resultMaps := make([]map[string]SyncedSeq, concurrency)
118+
resultMaps := make([]map[string]SyncedSeq, currency)
114119

115-
for i := 0; i < concurrency; i++ {
120+
for i := 0; i < currency; i++ {
116121
wg.Add(1)
117122
start := i * partSize
118123
end := start + partSize
119-
if i == concurrency-1 {
124+
if i == currency-1 {
120125
end = len(conversationIDList)
121126
}
122127

‎tools/changelog/changelog.go

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ func (g *GitHubRepo) classifyReleaseNotes(body string) map[string][]string {
5353
lines := strings.Split(body, "\n")
5454

5555
for _, line := range lines {
56+
// Skip lines that contain "deps: Merge"
57+
if strings.Contains(strings.ToLower(line), "deps: merge #") {
58+
continue
59+
}
60+
5661
// Use a regular expression to extract Full Changelog link and its title (case insensitive).
5762
if strings.Contains(strings.ToLower(line), "**full changelog**") {
5863
matches := regexp.MustCompile(`(?i)\*\*full changelog\*\*: (https://github\.com/[^\s]+/compare/([^\s]+))`).FindStringSubmatch(line)

0 commit comments

Comments
 (0)
Please sign in to comment.