missing datacenter resource

This commit is contained in:
mr 2024-10-07 11:37:37 +02:00
parent 1d0b06ac4a
commit c09994fd84
2 changed files with 7 additions and 7 deletions

View File

@ -71,16 +71,13 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string, caller *tools
// LaunchPeerExecution launches an execution on a peer // LaunchPeerExecution launches an execution on a peer
func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string, func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
dt tools.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) { dt tools.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) {
fmt.Println("Launching peer execution on", caller.URLS, dt, method)
methods := caller.URLS[dt] // Get the methods url of the data type methods := caller.URLS[dt] // Get the methods url of the data type
if _, ok := methods[method]; !ok { if m, ok := methods[method]; !ok || m == "" {
return nil, errors.New("no path found") return nil, errors.New("no path found")
} }
meth := methods[method] // Get the method url to execute meth := methods[method] // Get the method url to execute
if meth == "" {
return nil, errors.New("no path found")
} else {
meth = strings.ReplaceAll(meth, ":id", dataID) // Replace the id in the url in case of a DELETE / UPDATE method (it's a standard naming in OC) meth = strings.ReplaceAll(meth, ":id", dataID) // Replace the id in the url in case of a DELETE / UPDATE method (it's a standard naming in OC)
}
url := "" url := ""
// Check the status of the peer // Check the status of the peer
if mypeer, ok := p.checkPeerStatus(peerID, dt.API(), caller); !ok { if mypeer, ok := p.checkPeerStatus(peerID, dt.API(), caller); !ok {

View File

@ -192,6 +192,9 @@ func (wfa *workflowMongoAccessor) share(realData *Workflow, delete bool, caller
* execution is a create or delete function for the workflow executions depending on the schedule of the workflow * execution is a create or delete function for the workflow executions depending on the schedule of the workflow
*/ */
func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delete bool) (int, error) { func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delete bool) (int, error) {
if ok, _ := realData.CheckBooking(wfa.Caller); !ok { // check the booking of the workflow
return 409, errors.New("could not book the workflow")
}
var err error var err error
nats := tools.NewNATSCaller() // create a new nats caller because executions are sent to the nats for daemons nats := tools.NewNATSCaller() // create a new nats caller because executions are sent to the nats for daemons
if !realData.ScheduleActive { // if the schedule is not active, delete the executions if !realData.ScheduleActive { // if the schedule is not active, delete the executions