mongo ping go rountine 막음

This commit is contained in:
2023-11-22 18:23:41 +09:00
parent 6ad727c728
commit 343754ba7f

View File

@ -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