mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
fix: add mongo ping detection
This commit is contained in:
parent
e99577b21f
commit
68e29cd360
@ -54,6 +54,9 @@ func NewMongo() (*Mongo, error) {
|
||||
defer cancel()
|
||||
mongoClient, err = mongo.Connect(ctx, options.Client().ApplyURI(uri))
|
||||
if err == nil {
|
||||
if err = mongoClient.Ping(ctx, nil); err != nil {
|
||||
return nil, errs.Wrap(err, uri)
|
||||
}
|
||||
return &Mongo{db: mongoClient}, nil
|
||||
}
|
||||
if shouldRetry(err) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user