mongo stability debug + zoom
This commit is contained in:
parent
fa52c71e93
commit
efa73d8a45
@ -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]
|
||||
|
@ -3,6 +3,7 @@ package graph
|
||||
import "cloud.o-forge.io/core/oc-lib/models/resources"
|
||||
|
||||
type Graph struct {
|
||||
Zoom float64 `bson:"zoom" json:"zoom" validate:"required"`
|
||||
Items map[string]GraphItem `bson:"items" json:"items" default:"{}" validate:"required"`
|
||||
Links []GraphLink `bson:"links" json:"links" default:"{}" validate:"required"`
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ func (wfa *workflowMongoAccessor) execute(workflow *Workflow) {
|
||||
}
|
||||
resource, _, err := accessor.Search(filters, "")
|
||||
if err == nil && len(resource) > 0 {
|
||||
fmt.Println(workflow.Processings, resource[0].GetID())
|
||||
fmt.Println(workflow.Serialize(), resource[0].GetID())
|
||||
accessor.UpdateOne(&workspace.Workspace{
|
||||
Active: true,
|
||||
ResourceSet: resources.ResourceSet{
|
||||
|
Loading…
Reference in New Issue
Block a user