failed models
This commit is contained in:
parent
af18dba556
commit
4956166f76
@ -2,6 +2,7 @@ package workflow
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
@ -197,7 +198,10 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
|||||||
}, utils.WORKFLOW_EXECUTION.String())
|
}, utils.WORKFLOW_EXECUTION.String())
|
||||||
err := wfa.book(id, realData, []*workflow_execution.WorkflowExecution{}) // delete the booking of the workflow on the peers
|
err := wfa.book(id, realData, []*workflow_execution.WorkflowExecution{}) // delete the booking of the workflow on the peers
|
||||||
nats.SetNATSPub(utils.WORKFLOW.String(), tools.REMOVE, realData) // send the deletion to the nats
|
nats.SetNATSPub(utils.WORKFLOW.String(), tools.REMOVE, realData) // send the deletion to the nats
|
||||||
return 200, err
|
if err != nil {
|
||||||
|
return 409, err
|
||||||
|
}
|
||||||
|
return 200, nil
|
||||||
}
|
}
|
||||||
accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor(nil)
|
accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor(nil)
|
||||||
execs, err := wfa.getExecutions(id, realData) // get the executions of the workflow
|
execs, err := wfa.getExecutions(id, realData) // get the executions of the workflow
|
||||||
@ -240,11 +244,13 @@ func (wfa *workflowMongoAccessor) UpdateOne(set utils.DBObject, id string) (util
|
|||||||
// avoid the update if the schedule is the same
|
// avoid the update if the schedule is the same
|
||||||
avoid := set.(*Workflow).Schedule == nil || (res.(*Workflow).Schedule != nil && res.(*Workflow).ScheduleActive == set.(*Workflow).ScheduleActive && res.(*Workflow).Schedule.Start == set.(*Workflow).Schedule.Start && res.(*Workflow).Schedule.End == set.(*Workflow).Schedule.End && res.(*Workflow).Schedule.Cron == set.(*Workflow).Schedule.Cron)
|
avoid := set.(*Workflow).Schedule == nil || (res.(*Workflow).Schedule != nil && res.(*Workflow).ScheduleActive == set.(*Workflow).ScheduleActive && res.(*Workflow).Schedule.Start == set.(*Workflow).Schedule.Start && res.(*Workflow).Schedule.End == set.(*Workflow).Schedule.End && res.(*Workflow).Schedule.Cron == set.(*Workflow).Schedule.Cron)
|
||||||
res, code, err = wfa.GenericUpdateOne(set, id, wfa, &Workflow{})
|
res, code, err = wfa.GenericUpdateOne(set, id, wfa, &Workflow{})
|
||||||
|
fmt.Println(code, err)
|
||||||
if code != 200 {
|
if code != 200 {
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
if !avoid { // if the schedule is not avoided, update the executions
|
if !avoid { // if the schedule is not avoided, update the executions
|
||||||
if code, err := wfa.execution(id, res.(*Workflow), true); err != nil {
|
if code, err := wfa.execution(id, res.(*Workflow), true); code != 200 {
|
||||||
|
fmt.Println(code, err)
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user