mongo ping go rountine 막음
This commit is contained in:
26
mongo.go
26
mongo.go
@ -106,21 +106,21 @@ func newMongoClient(ctx context.Context, ci *ConnectionInfo) (MongoClient, error
|
||||
return MongoClient{}, err
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
if err := client.Ping(ctx, nil); err != nil {
|
||||
logger.Error("mongo client ping err :", err)
|
||||
}
|
||||
// go func() {
|
||||
// for {
|
||||
// if err := client.Ping(ctx, nil); err != nil {
|
||||
// logger.Error("mongo client ping err :", err)
|
||||
// }
|
||||
|
||||
select {
|
||||
case <-time.After(10 * time.Second):
|
||||
continue
|
||||
// select {
|
||||
// case <-time.After(10 * time.Second):
|
||||
// continue
|
||||
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
// case <-ctx.Done():
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// }()
|
||||
|
||||
mdb := client.Database(ci.Database, nil)
|
||||
return MongoClient{c: client, db: mdb}, nil
|
||||
|
||||
Reference in New Issue
Block a user