Comments (4)
This is a known issue and @annismckenzie has put together a nice PR #82 which is yet to be merged.
Hackish solution that might work for you:
func (p *ClusterState) unreachableLogic() {
timeLimit := p.CreatedAt.Add(time.Minute * 30)
if timeLimit.Before(p.Clock.Now()) {
e.FSM.SetState("CREATING") // it hangs here
}
}
func (p *ClusterState) beforeCreating(e *fsm.Event) {
p.Logger.Infof("Triggered event %v, trying to reach status %s", e.Event, e.Dst)
if p.Unreachable {
go p.unreachableLogic()
}
}
from fsm.
thanks for your help @itsprdp, I ended up with a solution that uses heavily the Metadata and GetMetadata feature and then a big switch case for a call to a transition to the desired state. Is of course sub-optimal, but unless the branch will not be merged, it is working. After the fix, I will revisit it. Thanks again for your help, really appreciated it!
from fsm.
The same happens if I try to trigger an FSM.Event instead of SetState
from fsm.
#88 was merged today and you may want to revisit this. 🙃
from fsm.
Related Issues (20)
- How to cancel a transition in callback?
- Deadlock calling `Event` in after-event callback when current state == dst
- Changing `Event.Dst` in before-event callback do not changing dst of transition HOT 1
- Why does the following test produce a data race? HOT 2
- New Release ? HOT 2
- Return errors as wrapped errors instead of a custom struct HOT 1
- Testing FSM objects: reflect.DeepEqual fails when FSM attribute is set on an object HOT 1
- fix typo HOT 1
- Can FSM.Transaction() accept a parameter to cancel the asynchronous transaction? HOT 2
- Any plan for supporting UML state machine? HOT 1
- callback error HOT 4
- Is this abandoned? HOT 2
- fsm.Event(ctx, ...) not work properly with context.WithTimeout() HOT 2
- Why fsm code not update to the latest version HOT 3
- Using enum instead strings
- Should cancelFunc be public? HOT 1
- Separate module path for the v1 releases
- Allow "No Transition" HOT 1
- Callbacks for complex FSM HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsm.