Skip to content

Commit

Permalink
Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
feedmeapples committed Mar 22, 2023
1 parent 8b40c48 commit 97ce5b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions workflow/workflow_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func UnmarshalMemoFromCLI(c *cli.Context) (map[string]interface{}, error) {
type historyTableIter struct {
iter iterator.Iterator[*historypb.HistoryEvent]
maxFieldLength int
lastEvent *historypb.HistoryEvent
wfResult *historypb.HistoryEvent
}

func (h *historyTableIter) HasNext() bool {
Expand All @@ -256,7 +256,7 @@ func (h *historyTableIter) Next() (interface{}, error) {
return nil, err
}

reflect.ValueOf(h.lastEvent).Elem().Set(reflect.ValueOf(event).Elem())
reflect.ValueOf(h.wfResult).Elem().Set(reflect.ValueOf(event).Elem())

// adapted structure for Table output view
return struct {
Expand Down Expand Up @@ -297,15 +297,15 @@ func printWorkflowProgress(c *cli.Context, wid, rid string, watch bool) error {
fmt.Println(color.Magenta(c, "Progress:"))
}

var lastEvent historypb.HistoryEvent
var wfResult historypb.HistoryEvent

errChan := make(chan error)
go func() {
iter := sdkClient.GetWorkflowHistory(tcCtx, wid, rid, watch, enumspb.HISTORY_EVENT_FILTER_TYPE_ALL_EVENT)
if isJSON {
printReplayableHistory(c, iter)
} else {
hIter := &historyTableIter{iter: iter, maxFieldLength: maxFieldLength, lastEvent: &lastEvent}
hIter := &historyTableIter{iter: iter, maxFieldLength: maxFieldLength, wfResult: &wfResult}
po := &output.PrintOptions{
Fields: []string{"ID", "Time", "Type"},
FieldsLong: []string{"Details"},
Expand Down Expand Up @@ -344,7 +344,7 @@ func printWorkflowProgress(c *cli.Context, wid, rid string, watch bool) error {
if watch {
fmt.Printf(" Run Time: %d seconds\n", timeElapsed)
}
printRunStatus(c, &lastEvent)
printRunStatus(c, &wfResult)
}
return nil
case err = <-errChan:
Expand Down

0 comments on commit 97ce5b8

Please sign in to comment.