diff --git a/pkg/common/db/mgo/msg_del.go b/pkg/common/db/mgo/msg_del.go deleted file mode 100644 index cee5fa065..000000000 --- a/pkg/common/db/mgo/msg_del.go +++ /dev/null @@ -1,71 +0,0 @@ -package mgo - -import ( - "github.com/openimsdk/open-im-server/v3/pkg/common/db/table/relation" - "go.mongodb.org/mongo-driver/mongo" -) - -func NewMsgDelMongo(db *mongo.Database) *MsgDelMgo { - return &MsgDelMgo{coll: db.Collection(new(relation.MsgDocModel).TableName())} -} - -type MsgDelMgo struct { - coll *mongo.Collection - model relation.MsgDocModel -} - -//func (m *MsgDelMgo) getEmptyMsg(ctx context.Context, limit int) ([]string, error) { -// return mongoutil.Aggregate[string](ctx, m.coll, []bson.M{ -// { -// "$match": bson.M{ -// "msgs": bson.M{ -// "$exists": true, -// }, -// }, -// }, -// { -// "$project": bson.M{ -// "_id": 0, -// "doc_id": 1, -// "all_null_msgs": bson.M{ -// "$not": []bson.M{ -// { -// "$anyElementTrue": bson.M{ -// "$map": bson.M{ -// "input": "$msgs", -// "as": "item", -// "in": "$$item.msg", -// }, -// }, -// }, -// }, -// }, -// }, -// }, -// { -// "$project": bson.M{ -// "doc_id": 1, -// }, -// }, -// { -// "$limit": limit, -// }, -// }) -//} -// -//func (m *MsgDelMgo) deleteEmptyMsgs(ctx context.Context) error { -// for { -// docIDs, err := m.getEmptyMsg(ctx, 100) -// if err != nil { -// return err -// } -// if len(docIDs) == 0 { -// return nil -// } -// for _, docID := range docIDs { -// if err := m.deleteEmptyMsg(ctx, docID); err != nil { -// return err -// } -// } -// } -//} diff --git a/pkg/common/db/mgo/msg_test.go b/pkg/common/db/mgo/msg_test.go deleted file mode 100644 index 0a92b7d4a..000000000 --- a/pkg/common/db/mgo/msg_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package mgo - -import ( - "context" - "github.com/openimsdk/protocol/msg" - "github.com/openimsdk/tools/mcontext" - "github.com/openimsdk/tools/mw" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "testing" - "time" -) - -func TestName(t *testing.T) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*3) - defer cancel() - ctx = mcontext.SetOpUserID(ctx, "imAdmin") - ctx = mcontext.SetOperationID(ctx, "test123456") - - conn, err := grpc.DialContext(ctx, "172.16.8.48:10130", grpc.WithTransportCredentials(insecure.NewCredentials()), mw.GrpcClient()) - if err != nil { - panic(err) - } - defer conn.Close() - cli := msg.NewMsgClient(conn) - var ts int64 - - ts = time.Now().UnixMilli() - - if _, err := cli.ClearMsg(ctx, &msg.ClearMsgReq{Timestamp: ts}); err != nil { - panic(err) - } - t.Log("success!") -}