Skip to content
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

Fix so checkAction will be able to validate if the next action should be skipped or not #121

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

yashsinghcodes
Copy link
Member

The approach is pretty simple we skip the actions if all the parents are skipped.

Now 3621997 fixes the issue where it was not related to child node skip but where the decide execution was not able to get the next action. Adding a validation with CheckNextAction at the main DecideExecution should already fix the problem as I found out during my tests but by making CheckNextAction itself skips the action saves a lot of time in my opinion.

@frikky let me know what you think if there are any mistake I'll try to resolve and retest ASAP. Thanks for all the help on this really learnt a lot 🙏

@yashsinghcodes
Copy link
Member Author

Please if in future while merging also merge the https://github.com/Shuffle/shaffuru/pull/390 as it breaks one of the condition which could create a problem.

Copy link
Member

@frikky frikky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix pls

skippedParents := 0
for _, parent := range parents[actionId] {
_, result := GetActionResult(ctx, *workflowExecution, parent)
if result.Status == "SKIPPED" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you verified this works, both with a few skipped and a lot of them, along with some success, some failure etc?

This feels wrong, but I'm not sure why.

shared.go Outdated
log.Printf("ERROR %s", err)
}
copy(nextActions[index:], nextActions[index+1:])
nextActions[len(nextActions)-1] = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is overcomplicated, and I'm worried about indexing issues. Did you test it well, both with a lot of items and 0? This seems like it can crash if there is only 1 item.

I typically make a new array entirely for stuff like this, as index modification is awful. Such as: Why would it be necessary to set a value to "" if you are just about to delete it? That doesn't seem necessary.

CompletedAt: 0,
Status: "SKIPPED",
}
resultData, err := json.Marshal(newResult)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some space between each section. This is hard to read.

The simplest "rule" for easy readability and space is to have at least one newline at the end of a section, such as:

`if x == y {

}

if x2 == y2 {

}

@frikky
Copy link
Member

frikky commented Nov 6, 2024

@yashsinghcodes tell me when it's done please :)

@yashsinghcodes
Copy link
Member Author

@frikky resolved the conflicts. Ready for merge.

@frikky frikky merged commit 603ed52 into Shuffle:main Nov 6, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants