correct is DC link

This commit is contained in:
mr 2024-08-20 16:22:06 +02:00
parent d13249d87d
commit c6ea2195ed
3 changed files with 41 additions and 14 deletions

View File

@ -51,7 +51,6 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string, url string
if !p.checkPeerStatus(peerID) {
return nil, err
}
fmt.Println("LaunchPeerExecution", method, url, methods[method], body)
if method == tools.POST {
b, err = caller.CallPost(url, methods[method], body)
}

View File

@ -122,7 +122,11 @@ func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*w
if code != 200 {
continue
}
b, err := paccess.LaunchPeerExecution(p.GetID(), "", p.(*peer.Peer).Url, utils.BOOKING, tools.POST,
url := p.(*peer.Peer).Url
if p.(*peer.Peer).IsMySelf() {
url = "http://" + utils.BOOKING.String()
}
b, err := paccess.LaunchPeerExecution(p.GetID(), "", url, utils.BOOKING, tools.POST,
(&workflow_execution.WorkflowExecutions{
WorkflowID: id,
ResourceID: dc_id,

View File

@ -45,9 +45,13 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace
for _, p := range shared.Peers {
pp, code, _ := paccess.GetAccessor(nil).LoadOne(p)
if code == 200 {
b, err := paccess.LaunchPeerExecution(p, v, pp.(*peer.Peer).Url, utils.WORKSPACE, tools.DELETE, nil, wfa.Caller)
url := pp.(*peer.Peer).Url
if pp.(*peer.Peer).IsMySelf() {
url = "http://" + utils.WORKSPACE.String()
}
b, err := paccess.LaunchPeerExecution(p, v, url, utils.WORKSPACE, tools.DELETE, nil, wfa.Caller)
if err != nil && b == nil {
wfa.Logger.Error().Msg("Could not send to peer " + pp.(*peer.Peer).Url + ". Error: " + err.Error())
wfa.Logger.Error().Msg("Could not send to peer " + url + ". Error: " + err.Error())
}
}
}
@ -67,9 +71,13 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace
paccess := (&peer.Peer{})
pp, code, _ := paccess.GetAccessor(nil).LoadOne(p)
if code == 200 {
b, err := paccess.LaunchPeerExecution(p, v, pp.(*peer.Peer).Url, utils.WORKSPACE, tools.POST, workspace.Serialize(), wfa.Caller)
url := pp.(*peer.Peer).Url
if pp.(*peer.Peer).IsMySelf() {
url = "http://" + utils.WORKSPACE.String()
}
b, err := paccess.LaunchPeerExecution(p, v, url, utils.WORKSPACE, tools.POST, workspace.Serialize(), wfa.Caller)
if err != nil && b == nil {
wfa.Logger.Error().Msg("Could not send to peer " + pp.(*peer.Peer).Url + ". Error: " + err.Error())
wfa.Logger.Error().Msg("Could not send to peer " + url + ". Error: " + err.Error())
}
}
}
@ -105,9 +113,13 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace,
if code != 200 {
continue
}
b, err := paccess.LaunchPeerExecution(p, v, pp.(*peer.Peer).Url, utils.WORKFLOW, tools.DELETE, nil, wfa.Caller)
url := pp.(*peer.Peer).Url
if pp.(*peer.Peer).IsMySelf() {
url = "http://" + utils.WORKFLOW.String()
}
b, err := paccess.LaunchPeerExecution(p, v, url, utils.WORKFLOW, tools.DELETE, nil, wfa.Caller)
if err != nil && b == nil {
wfa.Logger.Error().Msg("Could not send to peer " + pp.(*peer.Peer).Url + ". Error: " + err.Error())
wfa.Logger.Error().Msg("Could not send to peer " + url + ". Error: " + err.Error())
}
}
}
@ -132,9 +144,13 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace,
}
pp, code, _ := paccess.GetAccessor(nil).LoadOne(p)
if code == 200 {
b, err := paccess.LaunchPeerExecution(p, shared.UUID, pp.(*peer.Peer).Url, utils.WORKFLOW, tools.POST, workflow.Serialize(), wfa.Caller)
url := pp.(*peer.Peer).Url
if pp.(*peer.Peer).IsMySelf() {
url = "http://" + utils.WORKFLOW.String()
}
b, err := paccess.LaunchPeerExecution(p, shared.UUID, url, utils.WORKFLOW, tools.POST, workflow.Serialize(), wfa.Caller)
if err != nil && b == nil {
wfa.Logger.Error().Msg("Could not send to peer " + pp.(*peer.Peer).Url + ". Error: " + err.Error())
wfa.Logger.Error().Msg("Could not send to peer " + url + ". Error: " + err.Error())
}
}
}
@ -157,9 +173,13 @@ func (wfa *sharedWorkspaceMongoAccessor) deleteToPeer(shared *SharedWorkspace) {
if code != 200 {
continue
}
b, err := paccess.LaunchPeerExecution(p.GetID(), shared.UUID, p.(*peer.Peer).Url, utils.SHARED_WORKSPACE, tools.DELETE, nil, wfa.Caller)
url := p.(*peer.Peer).Url
if p.(*peer.Peer).IsMySelf() {
url = "http://" + utils.SHARED_WORKSPACE.String()
}
b, err := paccess.LaunchPeerExecution(p.GetID(), shared.UUID, url, utils.SHARED_WORKSPACE, tools.DELETE, nil, wfa.Caller)
if err != nil && b == nil {
wfa.Logger.Error().Msg("Could not send to peer " + p.(*peer.Peer).Url + ". Error: " + err.Error())
wfa.Logger.Error().Msg("Could not send to peer " + url + ". Error: " + err.Error())
}
}
}
@ -177,9 +197,13 @@ func (wfa *sharedWorkspaceMongoAccessor) sendToPeer(shared *SharedWorkspace) {
if code != 200 {
continue
}
b, err := paccess.LaunchPeerExecution(p.GetID(), v, p.(*peer.Peer).Url, utils.SHARED_WORKSPACE, tools.POST, shared.Serialize(), wfa.Caller)
url := p.(*peer.Peer).Url
if p.(*peer.Peer).IsMySelf() {
url = "http://" + utils.SHARED_WORKSPACE.String()
}
b, err := paccess.LaunchPeerExecution(p.GetID(), v, url, utils.SHARED_WORKSPACE, tools.POST, shared.Serialize(), wfa.Caller)
if err != nil && b == nil {
wfa.Logger.Error().Msg("Could not send to peer " + p.(*peer.Peer).Url + ". Error: " + err.Error())
wfa.Logger.Error().Msg("Could not send to peer " + url + ". Error: " + err.Error())
}
}
}