Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -23408,10 +23408,13 @@ func CheckNextActions(ctx context.Context, workflowExecution *WorkflowExecution)
}
*/

for index, actionId := range nextActions {
var updatedActions []string

for _, actionId := range nextActions {
skippedParents := 0

if _, ok := parents[actionId]; !ok {
updatedActions = append(updatedActions, actionId)
continue
}

Expand All @@ -23435,32 +23438,33 @@ func CheckNextActions(ctx context.Context, workflowExecution *WorkflowExecution)
continue
}

nextActions = append(nextActions[:index], nextActions[index+1:]...)
}
} else {
updatedActions = append(updatedActions, actionId)
}
}

return nextActions
return updatedActions
}

func ActionSkip(ctx context.Context, foundAction Action, exec *WorkflowExecution, parent []string) error {
_, actionResult := GetActionResult(ctx, *exec, foundAction.ID)
if actionResult.Action.ID == foundAction.ID {
log.Printf("[DEBUG][%s] Result already exist for the action %s (%s)", exec.ExecutionId, foundAction.Label, foundAction.ID)
return nil
}

newResult := ActionResult{
Action: foundAction,
ExecutionId: exec.ExecutionId,
Authorization: exec.Authorization,
Result: fmt.Sprintf(`{"success": false, "reason": "Skipped because of previous node - %d" - %v}`, len(parent), parent),
Result: fmt.Sprintf(`{"success": false, "reason": "Skipped because of previous node - %d - %v"}`, len(parent), parent),
StartedAt: 0,
CompletedAt: 0,
Status: "SKIPPED",
}
resultData, err := json.Marshal(newResult)
if err != nil {
log.Printf("[ERROR] Failed skipping action")
return err
}

Expand Down