From 67e3bb2b0ccfdc383563d4e703a42503e021cc05 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 10 Feb 2025 17:50:17 +0800 Subject: [PATCH 1/5] update config --- config/notification.yml | 10 +++--- internal/tools/cron_test.go | 63 ------------------------------------- 2 files changed, 4 insertions(+), 69 deletions(-) delete mode 100644 internal/tools/cron_test.go diff --git a/config/notification.yml b/config/notification.yml index ba5ca1c21..9445a67c6 100644 --- a/config/notification.yml +++ b/config/notification.yml @@ -1,12 +1,10 @@ groupCreated: isSendMsg: true -# Reliability level of the message sending. -# Set to 1 to send only when online, 2 for guaranteed delivery. + # Deprecated. Fixed as 1. reliabilityLevel: 1 -# This setting is effective only when 'isSendMsg' is true. -# It controls whether to count unread messages. + # Deprecated. Fixed as false. unreadCount: false -# Configuration for offline push notifications. + # Configuration for offline push notifications. offlinePush: # Enables or disables offline push notifications. enable: false @@ -325,4 +323,4 @@ conversationSetPrivate: enable: true title: burn after reading desc: burn after reading - ext: burn after reading + ext: burn after reading \ No newline at end of file diff --git a/internal/tools/cron_test.go b/internal/tools/cron_test.go deleted file mode 100644 index 890349069..000000000 --- a/internal/tools/cron_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package tools - -import ( - "context" - "github.com/openimsdk/open-im-server/v3/pkg/common/config" - kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister" - pbconversation "github.com/openimsdk/protocol/conversation" - "github.com/openimsdk/protocol/msg" - "github.com/openimsdk/protocol/third" - "github.com/openimsdk/tools/mcontext" - "github.com/openimsdk/tools/mw" - "github.com/robfig/cron/v3" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "testing" -) - -func TestName(t *testing.T) { - conf := &config.Discovery{ - Enable: config.ETCD, - Etcd: config.Etcd{ - RootDirectory: "openim", - Address: []string{"localhost:12379"}, - }, - } - client, err := kdisc.NewDiscoveryRegister(conf, "source") - if err != nil { - panic(err) - } - client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials())) - ctx := mcontext.SetOpUserID(context.Background(), "imAdmin") - msgConn, err := client.GetConn(ctx, "msg-rpc-service") - if err != nil { - panic(err) - } - thirdConn, err := client.GetConn(ctx, "third-rpc-service") - if err != nil { - panic(err) - } - - conversationConn, err := client.GetConn(ctx, "conversation-rpc-service") - if err != nil { - panic(err) - } - - srv := &cronServer{ - ctx: ctx, - config: &CronTaskConfig{ - CronTask: config.CronTask{ - RetainChatRecords: 1, - FileExpireTime: 1, - DeleteObjectType: []string{"msg-picture", "msg-file", "msg-voice", "msg-video", "msg-video-snapshot", "sdklog", ""}, - }, - }, - cron: cron.New(), - msgClient: msg.NewMsgClient(msgConn), - conversationClient: pbconversation.NewConversationClient(conversationConn), - thirdClient: third.NewThirdClient(thirdConn), - } - srv.deleteMsg() - //srv.clearS3() - //srv.clearUserMsg() -} From 5ad72fa24c912b9662905d32ea295570fac28fbf Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 10 Feb 2025 17:53:21 +0800 Subject: [PATCH 2/5] update config --- internal/api/msg.go | 8 -------- internal/api/router.go | 2 -- 2 files changed, 10 deletions(-) diff --git a/internal/api/msg.go b/internal/api/msg.go index b21e792db..0b73af0cb 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -391,11 +391,3 @@ func (m *MessageApi) SearchMsg(c *gin.Context) { func (m *MessageApi) GetServerTime(c *gin.Context) { a2r.Call(c, msg.MsgClient.GetServerTime, m.Client) } - -func (m *MessageApi) GetStreamMsg(c *gin.Context) { - a2r.Call(c, msg.MsgClient.GetServerTime, m.Client) -} - -func (m *MessageApi) AppendStreamMsg(c *gin.Context) { - a2r.Call(c, msg.MsgClient.GetServerTime, m.Client) -} diff --git a/internal/api/router.go b/internal/api/router.go index da9d22463..216a43363 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -246,8 +246,6 @@ func newGinRouter(ctx context.Context, client discovery.SvcDiscoveryRegistry, cf msgGroup.POST("/batch_send_msg", m.BatchSendMsg) msgGroup.POST("/check_msg_is_send_success", m.CheckMsgIsSendSuccess) msgGroup.POST("/get_server_time", m.GetServerTime) - msgGroup.POST("/get_stream_msg", m.GetStreamMsg) - msgGroup.POST("/append_stream_msg", m.AppendStreamMsg) } // Conversation { From 811615aaa45b4ffeabaa85b427bdec0de215538c Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 10 Feb 2025 17:58:11 +0800 Subject: [PATCH 3/5] update config --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 09ef22e58..9a66d7cea 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/mitchellh/mapstructure v1.5.0 github.com/openimsdk/protocol v0.0.72-alpha.71 - github.com/openimsdk/tools v0.0.50-alpha.71 + github.com/openimsdk/tools v0.0.50-alpha.72 github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.18.0 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index eaa00aab0..6bd4ecde0 100644 --- a/go.sum +++ b/go.sum @@ -349,8 +349,8 @@ github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCF github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= github.com/openimsdk/protocol v0.0.72-alpha.71 h1:R3utzOlqepaJWTAmnfJi4ccUM/XIoFasSyjQMOipM70= github.com/openimsdk/protocol v0.0.72-alpha.71/go.mod h1:WF7EuE55vQvpyUAzDXcqg+B+446xQyEba0X35lTINmw= -github.com/openimsdk/tools v0.0.50-alpha.71 h1:QsjhJSqPnIy3ai6Xh2ic3xW8WtjBJlg5gK+d8qhXnck= -github.com/openimsdk/tools v0.0.50-alpha.71/go.mod h1:B+oqV0zdewN7OiEHYJm+hW+8/Te7B8tHHgD8rK5ZLZk= +github.com/openimsdk/tools v0.0.50-alpha.72 h1:d/vaZjIfvrNp3EeRJEIiamBO7HiPx6CP4wiuq8NpfzY= +github.com/openimsdk/tools v0.0.50-alpha.72/go.mod h1:B+oqV0zdewN7OiEHYJm+hW+8/Te7B8tHHgD8rK5ZLZk= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= From ca671a0e8e44d16c06022b064f0a902574169f93 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 10 Feb 2025 18:04:40 +0800 Subject: [PATCH 4/5] update config --- pkg/common/config/config.go | 3 ++- pkg/common/config/parse.go | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index bdfd44931..275dec70f 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -635,7 +635,7 @@ func (l *CacheConfig) Enable() bool { return l.Topic != "" && l.SlotNum > 0 && l.SlotSize > 0 } -var ( +const ( DiscoveryConfigFilename = "discovery.yml" KafkaConfigFileName = "kafka.yml" LocalCacheConfigFileName = "local-cache.yml" @@ -657,6 +657,7 @@ var ( RedisConfigFileName = "redis.yml" ShareFileName = "share.yml" WebhooksConfigFileName = "webhooks.yml" + NotificationFileName = "notification.yml" ) func (d *Discovery) GetConfigFileName() string { diff --git a/pkg/common/config/parse.go b/pkg/common/config/parse.go index 08f82ac7d..42cca08cd 100644 --- a/pkg/common/config/parse.go +++ b/pkg/common/config/parse.go @@ -26,9 +26,7 @@ import ( ) const ( - FileName = "config.yaml" - NotificationFileName = "notification.yaml" - DefaultFolderPath = "../config/" + FileName = "config.yaml" ) // return absolude path join ../config/, this is k8s container config path. From cfded3fb245cdc49ccc8ea959f273b9aabf97cb0 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 10 Feb 2025 18:08:04 +0800 Subject: [PATCH 5/5] update config --- tools/seq/internal/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/seq/internal/main.go b/tools/seq/internal/main.go index a19f6a721..574e7cef9 100644 --- a/tools/seq/internal/main.go +++ b/tools/seq/internal/main.go @@ -20,6 +20,7 @@ import ( "github.com/openimsdk/open-im-server/v3/pkg/common/storage/database/mgo" "github.com/openimsdk/tools/db/mongoutil" "github.com/openimsdk/tools/db/redisutil" + "github.com/openimsdk/tools/utils/runtimeenv" "github.com/redis/go-redis/v9" "github.com/spf13/viper" "go.mongodb.org/mongo-driver/bson" @@ -64,11 +65,11 @@ func readConfig[T any](dir string, name string) (*T, error) { } func Main(conf string, del time.Duration) error { - redisConfig, err := readConfig[config.Redis](conf, cmd.RedisConfigFileName) + redisConfig, err := readConfig[config.Redis](conf, config.RedisConfigFileName) if err != nil { return err } - mongodbConfig, err := readConfig[config.Mongo](conf, cmd.MongodbConfigFileName) + mongodbConfig, err := readConfig[config.Mongo](conf, config.MongodbConfigFileName) if err != nil { return err }