mongo and or
This commit is contained in:
parent
89f14d99b8
commit
51541010e2
@ -68,8 +68,10 @@ func (m *MongoDB) createClient(MongoURL string) error {
|
||||
isConnected = false
|
||||
return errors.New("Mongodb connect " + MongoURL + ":" + err.Error())
|
||||
}
|
||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
if err = mngoClient.Ping(MngoCtx, nil); err != nil || mngoClient == nil {
|
||||
if err = mngoClient.Ping(MngoCtx, nil); err != nil {
|
||||
mngoClient = nil
|
||||
isConnected = false
|
||||
return errors.New("Mongodb ping " + MongoURL + ":" + err.Error())
|
||||
|
Loading…
Reference in New Issue
Block a user