Skip to content

Commit

Permalink
Merge eed0730 into d56d3e9
Browse files Browse the repository at this point in the history
  • Loading branch information
displague authored Apr 29, 2022
2 parents d56d3e9 + eed0730 commit 63fe227
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/dbserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
errInvalidActionName = "invalid action name"
errInvalidTaskReported = "reported task name does not match the current action details"
errInvalidActionReported = "reported action name does not match the current action details"
errInvalidActionIndex = "invalid action index for workflow"

msgReceivedStatus = "received action status: %s"
msgCurrentWfContext = "current workflow context"
Expand Down
5 changes: 5 additions & 0 deletions server/dbserver_worker_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ func (s *DBServer) ReportActionStatus(ctx context.Context, req *workflow.Workflo
actionIndex++
}
}

if wfContext.TotalNumberOfActions > 1 && actionIndex == wfContext.TotalNumberOfActions-1 {
return nil, status.Errorf(codes.FailedPrecondition, errInvalidActionIndex)
}

action := wfActions.ActionList[actionIndex]
if action.GetTaskName() != req.GetTaskName() {
return nil, status.Errorf(codes.InvalidArgument, errInvalidTaskReported)
Expand Down

0 comments on commit 63fe227

Please sign in to comment.