-
Notifications
You must be signed in to change notification settings - Fork 627
Timer not trigger when resetStateMachine #381
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
Comments
Ah yeah, I think this is caused because timer(timerOnce) is created when state is entered. When machine is reset, state is not entered thus timer doesn't activate. We need to create some kind of hook to this. |
Is there any work around to reset the state and trigger the timer as we want to restore the state machine from the persistent. |
I'm not sure. Basically scheduling works by arming/disarming triggers when state is entered/exited. |
I'm trying to sneak this in to a next release as I have a concept working. Just need to figure out some corner cases but it's just basically arming those triggers for active state(s) which are restored. |
- As passing in null context don't have any meaning other than doing reset with pre-defined behaviour which currently just resets back to initial state and clears extended state variables. Now Also clearing machine id back to null which is anyway a default value. - Fixes spring-projects#381
Merged per 66c1a53 |
Wrong commit message, going to hard reset this branch. |
- Previously timer were only armed when state were entered, thus failing for timer to work if machine were restored. Now changing logic so that that state have a lifecycle which is called during machine reset. - Fixes #381
I am developing a game using spring statemachine, and want to restore the state machine from the db record;
I have checked the similar question from The right way to reload and restart State Machine with different data set
But it seems the timer transition is not trigger when reset. Below is My code.
There are three state, the transition is timer base.
Ready(1 second) -> A (1 second)-> B.
My Question is:
We expected when restore the state machine with state A, it will transit to the state B after one second, but it kept in the state A all the time.
The text was updated successfully, but these errors were encountered: