light modification
This commit is contained in:
parent
e9278111a6
commit
4be954a6f3
@ -73,7 +73,7 @@ func (p *Peer) IsMySelf() (bool, string) {
|
||||
}
|
||||
|
||||
// LaunchPeerExecution launches an execution on a peer
|
||||
func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) {
|
||||
func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, body interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) {
|
||||
p.UUID = peerID
|
||||
return cache.LaunchPeerExecution(peerID, dataID, dt, method, body, caller) // Launch the execution on the peer through the cache
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
type PeerExecution struct {
|
||||
Method string `json:"method" bson:"method"`
|
||||
Url string `json:"url" bson:"url"`
|
||||
Body map[string]interface{} `json:"body" bson:"body"`
|
||||
Body interface{} `json:"body" bson:"body"`
|
||||
DataType int `json:"data_type" bson:"data_type"`
|
||||
DataID string `json:"data_id" bson:"data_id"`
|
||||
}
|
||||
@ -84,7 +84,7 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string, caller *tools
|
||||
|
||||
// LaunchPeerExecution launches an execution on a peer
|
||||
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 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
|
||||
if m, ok := methods[method]; !ok || m == "" {
|
||||
@ -128,7 +128,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
||||
}
|
||||
|
||||
// exec executes the method on the peer
|
||||
func (p *PeerCache) exec(url string, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) error {
|
||||
func (p *PeerCache) exec(url string, method tools.METHOD, body interface{}, caller *tools.HTTPCaller) error {
|
||||
var b []byte
|
||||
var err error
|
||||
fmt.Println("Executing", method, "on", url, "with", body)
|
||||
|
@ -155,7 +155,7 @@ func (ws *WorkflowSchedule) getDates() ([]Schedule, error) {
|
||||
schedule := []Schedule{}
|
||||
if len(ws.Cron) > 0 { // if cron is set then end date should be set
|
||||
if ws.End == nil {
|
||||
return schedule, errors.New("a cron task should have an end date.")
|
||||
return schedule, errors.New("a cron task should have an end date")
|
||||
}
|
||||
if ws.DurationS <= 0 {
|
||||
ws.DurationS = ws.End.Sub(ws.Start).Seconds()
|
||||
|
Loading…
Reference in New Issue
Block a user