mongo stability debug + zoom
This commit is contained in:
@@ -92,6 +92,8 @@ func (m *MongoDB) createClient(MongoURL string) error {
|
||||
func (m *MongoDB) prepareDB(list_collection []string, config MongoConf) {
|
||||
var err error
|
||||
mngoDB = mngoClient.Database(config.GetDatabase())
|
||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
existingCollections, err = mngoDB.ListCollectionNames(MngoCtx, bson.D{})
|
||||
if err != nil {
|
||||
m.Logger.Fatal().Msg("Error contacting MongoDB\n" + err.Error())
|
||||
@@ -116,6 +118,8 @@ func (m *MongoDB) prepareDB(list_collection []string, config MongoConf) {
|
||||
// Creates the collection with index specified in mongo/mongo_collections
|
||||
// or use the basic collection creation function
|
||||
func (m *MongoDB) createCollection(collection_name string, new_collection *mongo.Collection) {
|
||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
var err error
|
||||
CollectionMap[collection_name] = new_collection
|
||||
_, exists := IndexesMap[collection_name]
|
||||
|
Reference in New Issue
Block a user