-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 FlowBuilder.next().end()
infinite loop
#4475
Conversation
State next = createState(input); | ||
addTransition("COMPLETED", next); | ||
addTransition("*", failedState); | ||
this.currentState = next; |
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.
if (this.currentState == null) {
doStart(input); // 1. currentState: input
}
State next = createState(input);
// 2. input -> COMPLETED -> input -> COMPLETED -> input ..
addTransition("COMPLETED", next);
when currentState == null
, I think we should not addTransition("COMPLETED", next);
cause it makes infinite loop 🤔
} else { | ||
State state = createState(input); | ||
tos.put(currentState.getName(), currentState); | ||
currentState = state; |
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.
When currrent == null
, previous doFrom
logic seems createState(input)
twice (inside of doStart()
and L273
) so I fix it~!
Gentle ping to @fmbenhassine , can you review this PR? I need to fix this for my service🙇 thanks for your help! |
LGTM 👍 Rebased and merged as 4a67b22. Thank you for your contribution! |
Thanks a lot for review&merge! I'll make another contribution soon 🙇 |
related issue #4432
Motivation:
FlowBuilder.next().end()
never finishesaddTransition("COMPLETED", next);
onnext()
although there's no step registered yetModification:
FlowBuilder.next().end()
, handle same asFlowBuilder.start().end()
to avoid infinite loopResult:
FlowBuilder.next().end()
works same asFlowBuilder.start().end()
and finishes well