Skip to content

Commit

Permalink
fix flow
Browse files Browse the repository at this point in the history
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
  • Loading branch information
vtolstov committed Aug 20, 2021
1 parent a45b672 commit 70adfea
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions flow/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ func (w *microWorkflow) Execute(ctx context.Context, req *Message, opts ...Execu
}
w.Unlock()

id, err := id.New()
eid, err := id.New()
if err != nil {
return "", err
}

stepStore := store.NewNamespaceStore(w.opts.Store, filepath.Join("steps", id))
workflowStore := store.NewNamespaceStore(w.opts.Store, filepath.Join("workflows", id))
stepStore := store.NewNamespaceStore(w.opts.Store, filepath.Join("steps", eid))
workflowStore := store.NewNamespaceStore(w.opts.Store, filepath.Join("workflows", eid))

options := NewExecuteOptions(opts...)

Expand Down Expand Up @@ -214,13 +214,13 @@ func (w *microWorkflow) Execute(ctx context.Context, req *Message, opts ...Execu

if werr := workflowStore.Write(w.opts.Context, "status", &codec.Frame{Data: []byte(StatusRunning.String())}); werr != nil {
w.opts.Logger.Errorf(w.opts.Context, "store error: %v", werr)
return id, werr
return eid, werr
}
for idx := range steps {
for nidx := range steps[idx] {
cstep := steps[idx][nidx]
if werr := stepStore.Write(ctx, filepath.Join(cstep.ID(), "status"), &codec.Frame{Data: []byte(StatusPending.String())}); werr != nil {
return id, werr
return eid, werr
}
}
}
Expand Down Expand Up @@ -316,7 +316,7 @@ func (w *microWorkflow) Execute(ctx context.Context, req *Message, opts ...Execu
}()

if options.Async {
return id, nil
return eid, nil
}

logger.Tracef(ctx, "wait for finish or error")
Expand All @@ -329,7 +329,7 @@ func (w *microWorkflow) Execute(ctx context.Context, req *Message, opts ...Execu
close(cherr)
case <-chstatus:
close(chstatus)
return uid.String(), nil
return eid, nil
}

switch {
Expand All @@ -350,7 +350,7 @@ func (w *microWorkflow) Execute(ctx context.Context, req *Message, opts ...Execu
break
}

return uid.String(), err
return eid, err
}

func NewFlow(opts ...Option) Flow {
Expand Down

0 comments on commit 70adfea

Please sign in to comment.