diff --git a/models/workflow/workflow_mongo_accessor.go b/models/workflow/workflow_mongo_accessor.go index ad467c7..9930047 100644 --- a/models/workflow/workflow_mongo_accessor.go +++ b/models/workflow/workflow_mongo_accessor.go @@ -3,6 +3,7 @@ package workflow import ( "errors" "fmt" + "slices" "strings" "cloud.o-forge.io/core/oc-lib/dbs" @@ -126,8 +127,13 @@ func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*w } if g != nil && g.Links != nil && len(g.Links) > 0 { // if the graph is set and has links then book the workflow (even on ourselves) accessor := (&compute.ComputeResource{}).GetAccessor(nil) + isDCFound := []string{} for _, link := range g.Links { if ok, dc_id := realData.isDCLink(link); ok { // check if the link is a link between a compute and a resource booking is only on compute + if slices.Contains(isDCFound, dc_id) { + continue + } // if the compute is already found, skip it + isDCFound = append(isDCFound, dc_id) dc, code, _ := accessor.LoadOne(dc_id) if code != 200 { continue