mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-21 20:49:24 +08:00
don't update phase for already terminated workflow
This commit is contained in:
@@ -905,7 +905,7 @@ func (c *Client) createWorkflowExecutionDB(namespace string, workflowExecution *
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) FinishWorkflowExecutionStatisticViaExitHandler(namespace, name string, workflowTemplateID int64, phase wfv1.NodePhase, startedAt time.Time) (err error) {
|
func (c *Client) FinishWorkflowExecutionStatisticViaExitHandler(namespace, name string, phase wfv1.NodePhase, startedAt time.Time) (err error) {
|
||||||
_, err = sb.Update("workflow_executions").
|
_, err = sb.Update("workflow_executions").
|
||||||
SetMap(sq.Eq{
|
SetMap(sq.Eq{
|
||||||
"started_at": startedAt.UTC(),
|
"started_at": startedAt.UTC(),
|
||||||
@@ -914,7 +914,7 @@ func (c *Client) FinishWorkflowExecutionStatisticViaExitHandler(namespace, name
|
|||||||
"finished_at": time.Now().UTC(),
|
"finished_at": time.Now().UTC(),
|
||||||
"phase": phase,
|
"phase": phase,
|
||||||
}).
|
}).
|
||||||
Where(sq.Eq{"name": name}).
|
Where(sq.Eq{"name": name}, sq.NotEq{"phase": "Terminated"}).
|
||||||
RunWith(c.DB).
|
RunWith(c.DB).
|
||||||
Exec()
|
Exec()
|
||||||
|
|
||||||
|
@@ -143,8 +143,7 @@ func (s *WorkflowServer) AddWorkflowExecutionStatistics(ctx context.Context, req
|
|||||||
return &empty.Empty{}, err
|
return &empty.Empty{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = client.FinishWorkflowExecutionStatisticViaExitHandler(req.Namespace, req.Uid,
|
err = client.FinishWorkflowExecutionStatisticViaExitHandler(req.Namespace, req.Uid, phase, workflow.Status.StartedAt.UTC())
|
||||||
req.Statistics.WorkflowTemplateId, phase, workflow.Status.StartedAt.UTC())
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &empty.Empty{}, err
|
return &empty.Empty{}, err
|
||||||
|
Reference in New Issue
Block a user