draft test
This commit is contained in:
@@ -50,9 +50,9 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string) (*Peer, bool)
|
||||
// LaunchPeerExecution launches an execution on a peer
|
||||
// The method contacts the path described by : peer.Url + datatype path (from enums) + replacement of id by dataID
|
||||
func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
||||
dt tools.DataType, method tools.METHOD, body 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
|
||||
dt tools.DataType, method tools.METHOD, body interface{}, caller tools.HTTPCallerITF) (*PeerExecution, error) {
|
||||
fmt.Println("Launching peer execution on", caller.GetUrls(), dt, method)
|
||||
methods := caller.GetUrls()[dt] // Get the methods url of the data type
|
||||
if m, ok := methods[method]; !ok || m == "" {
|
||||
return nil, errors.New("Requested method " + method.String() + " not declared in HTTPCaller")
|
||||
}
|
||||
@@ -83,14 +83,14 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
||||
mypeer.FailedExecution = []PeerExecution{} // Reset the failed executions list
|
||||
NewShallowAccessor().UpdateOne(mypeer, peerID) // Update the peer in the db
|
||||
for _, v := range tmp { // Retry the failed executions
|
||||
go p.exec(v.Url, tools.ToMethod(v.Method), v.Body, caller)
|
||||
go p.Exec(v.Url, tools.ToMethod(v.Method), v.Body, caller)
|
||||
}
|
||||
}
|
||||
return nil, p.exec(url, method, body, caller) // Execute the method
|
||||
return nil, p.Exec(url, method, body, caller) // Execute the method
|
||||
}
|
||||
|
||||
// exec executes the method on the peer
|
||||
func (p *PeerCache) exec(url string, method tools.METHOD, body interface{}, caller *tools.HTTPCaller) error {
|
||||
func (p *PeerCache) Exec(url string, method tools.METHOD, body interface{}, caller tools.HTTPCallerITF) error {
|
||||
var b []byte
|
||||
var err error
|
||||
if method == tools.POST { // Execute the POST method if it's a POST method
|
||||
|
||||
Reference in New Issue
Block a user