|
@@ -2,14 +2,10 @@ package mgodb
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
- "eta/eta_forum_hub/utils"
|
|
|
"fmt"
|
|
|
- "go.mongodb.org/mongo-driver/bson"
|
|
|
- "go.mongodb.org/mongo-driver/event"
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
|
"go.mongodb.org/mongo-driver/mongo/options"
|
|
|
"go.mongodb.org/mongo-driver/mongo/readpref"
|
|
|
- "sync"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -42,7 +38,7 @@ func NewMgoClient(mgoConfig MgoConfig) *mongo.Client {
|
|
|
Password: mgoConfig.Password,
|
|
|
}
|
|
|
clientOpts := options.Client().ApplyURI(mgoConfig.Url).SetAuth(credential)
|
|
|
- startedCommands := sync.Map{} // map[int64]bson.Raw
|
|
|
+ /*startedCommands := sync.Map{} // map[int64]bson.Raw
|
|
|
|
|
|
cmdMonitor := &event.CommandMonitor{
|
|
|
Started: func(_ context.Context, evt *event.CommandStartedEvent) {
|
|
@@ -77,7 +73,7 @@ func NewMgoClient(mgoConfig MgoConfig) *mongo.Client {
|
|
|
|
|
|
// 创建options
|
|
|
|
|
|
- clientOpts.SetMonitor(cmdMonitor)
|
|
|
+ clientOpts.SetMonitor(cmdMonitor)*/
|
|
|
|
|
|
clientOpts.SetMinPoolSize(MinPoolSize)
|
|
|
clientOpts.SetMaxPoolSize(MaxPoolSize)
|