Skip to content

Commit

Permalink
Fixed a review comment for reduce indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
parauliya committed Jul 30, 2020
1 parent ec40f7f commit 42621d5
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,28 +162,29 @@ func GetWorkflowDataVersion(context context.Context, workflowID string, sdb *sql
// The below function check whether a particular workflow context is applicable or needed to
// be send to a worker based on the state of the current action and the targeted workerID.
func isApplicableToSend(context context.Context, wfContext *pb.WorkflowContext, workerID string, sdb *sql.DB) bool {
if wfContext.GetCurrentActionState() != pb.ActionState_ACTION_FAILED ||
wfContext.GetCurrentActionState() != pb.ActionState_ACTION_TIMEOUT {
actions, err := GetWorkflowActions(context, &pb.WorkflowActionsRequest{WorkflowId: wfContext.GetWorkflowId()}, sdb)
if err != nil {
if wfContext.GetCurrentActionState() == pb.ActionState_ACTION_FAILED ||
wfContext.GetCurrentActionState() == pb.ActionState_ACTION_TIMEOUT {
return false
}
actions, err := GetWorkflowActions(context, &pb.WorkflowActionsRequest{WorkflowId: wfContext.GetWorkflowId()}, sdb)
if err != nil {
return false
}
if wfContext.GetCurrentActionState() == pb.ActionState_ACTION_SUCCESS {
if isLastAction(wfContext, actions) {
return false
}
if wfContext.GetCurrentActionState() == pb.ActionState_ACTION_SUCCESS {
if isLastAction(wfContext, actions) {
return false
}
if wfContext.GetCurrentActionIndex() == 0 {
if actions.ActionList[wfContext.GetCurrentActionIndex()+1].GetWorkerId() == workerID {
log.Println("Send the workflow context ", wfContext.GetWorkflowId())
return true
}
}
} else {
if actions.ActionList[wfContext.GetCurrentActionIndex()].GetWorkerId() == workerID {
if wfContext.GetCurrentActionIndex() == 0 {
if actions.ActionList[wfContext.GetCurrentActionIndex()+1].GetWorkerId() == workerID {
log.Println("Send the workflow context ", wfContext.GetWorkflowId())
return true
}
}
} else {
if actions.ActionList[wfContext.GetCurrentActionIndex()].GetWorkerId() == workerID {
log.Println("Send the workflow context ", wfContext.GetWorkflowId())
return true
}
}
return false
}
Expand Down

0 comments on commit 42621d5

Please sign in to comment.