This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 8d8b694cf optimize workflow save dal logic
new 2ea48a480 Merge pull request #2895 from
walterlife/feature/optimize-workflow-save
8d8b694cf is described below
commit 8d8b694cf9a2dd70d5460b76cd562739bc7ca87d
Author: walterlife <[email protected]>
AuthorDate: Tue Jan 10 22:12:33 2023 +0800
optimize workflow save dal logic
---
eventmesh-workflow-go/internal/dal/workflow.go | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/eventmesh-workflow-go/internal/dal/workflow.go
b/eventmesh-workflow-go/internal/dal/workflow.go
index ca138db5e..6067f49e8 100644
--- a/eventmesh-workflow-go/internal/dal/workflow.go
+++ b/eventmesh-workflow-go/internal/dal/workflow.go
@@ -275,15 +275,17 @@ func (w *workflowDALImpl) create(ctx context.Context, tx
*gorm.DB, record *model
if r != nil {
return errors.New("workflow id already exists")
}
- record.WorkflowID = wf.ID
- record.WorkflowName = wf.Name
- record.Version = wf.Version
- record.Status = constants.NormalStatus
- record.CreateTime = time.Now()
- record.UpdateTime = time.Now()
+ var insertData = model.Workflow{}
+ insertData.WorkflowID = wf.ID
+ insertData.WorkflowName = wf.Name
+ insertData.Version = wf.Version
+ insertData.Definition = record.Definition
+ insertData.Status = constants.NormalStatus
+ insertData.CreateTime = time.Now()
+ insertData.UpdateTime = time.Now()
var handlers []func() error
handlers = append(handlers, func() error {
- return tx.Create(record).Error
+ return tx.Create(insertData).Error
})
tasks := w.buildTask(wf)
for _, task := range tasks {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]