-
Notifications
You must be signed in to change notification settings - Fork 263
getAction logic should not pick up the upstream actions in async execution mode #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -503,12 +503,23 @@ private Optional<StepAction> getAction(WorkflowSummary summary, String stepId) { | |
| Initiator initiator = summary.getInitiator(); | ||
| List<UpstreamInitiator.Info> path = new ArrayList<>(); | ||
| StringBuilder sqlBuilder = new StringBuilder(GET_ACTION_QUERY); | ||
| if (initiator instanceof UpstreamInitiator) { | ||
| path.addAll(((UpstreamInitiator) initiator).getAncestors()); | ||
| sqlBuilder | ||
| .append(" OR (") | ||
| .append(String.join(") OR (", Collections.nCopies(path.size(), CONDITION_POSTFIX))) | ||
| .append(')'); | ||
| if (initiator instanceof UpstreamInitiator upstreamInitiator) { | ||
| List<UpstreamInitiator.Info> ancestorPath = new ArrayList<>(); | ||
| for (var ancestor : upstreamInitiator.getAncestors().reversed()) { | ||
| // if a (sub)workflow is async, ignore actions from upstream ancestors at this point | ||
| if (ancestor.isAsync()) { | ||
| break; | ||
| } else { | ||
| ancestorPath.add(ancestor); | ||
| } | ||
| } | ||
| path.addAll(ancestorPath.reversed()); | ||
|
||
| if (!path.isEmpty()) { | ||
| sqlBuilder | ||
| .append(" OR (") | ||
| .append(String.join(") OR (", Collections.nCopies(path.size(), CONDITION_POSTFIX))) | ||
| .append(')'); | ||
| } | ||
| } | ||
| String sql = sqlBuilder.toString(); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using
varfor the loop variable reduces code readability. Consider using the explicit typeUpstreamInitiator.Info ancestorto make the code more self-documenting.