mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-10-26 21:22:16 +08:00 
			
		
		
		
	* pb * fix: Modifying other fields while setting IsPrivateChat does not take effect * fix: quote message error revoke * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * refactoring scheduled tasks * upgrading pkg tools * fix * fix * optimize log output * feat: support GetLastMessage * feat: support GetLastMessage * feat: s3 switch * feat: s3 switch * fix: GetUsersOnline * feat: SendBusinessNotification supported configuration parameters * feat: SendBusinessNotification supported configuration parameters * feat: SendBusinessNotification supported configuration parameters * feat: seq conversion failed without exiting * monolithic * fix: DeleteDoc crash * fix: DeleteDoc crash * fix: monolithic * fix: monolithic * fix: fill send time * fix: fill send time * fix: crash caused by withdrawing messages from users who have left the group * fix: mq * fix: mq * fix: user msg timestamp * fix: mq * 1 * 1 * 1 * 1 * 1 * 1 * 1 * seq read config * seq read config * 1 * 1 * fix: the source message of the reference is withdrawn, and the referenced message is deleted * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1 * 1
		
			
				
	
	
		
			65 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package cron
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/openimsdk/open-im-server/v3/pkg/common/config"
 | |
| 	kdisc "github.com/openimsdk/open-im-server/v3/pkg/common/discovery"
 | |
| 	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"
 | |
| )
 | |
| 
 | |
| 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, nil)
 | |
| 	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()
 | |
| }
 |