Multiple callbacks active at the same time
See original GitHub issueCurrently most of my state logic is contained in on_enter
callbacks. Since in some states I have to periodical checks, these callbacks run until the sate finishes.
Now I just noticed that it is possible that the on_enter CB of the following state is activated, while the old callback hasn’t finished yet. Is this behaviour desired?
In my case I probably will have to start using mutexes … 😖
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
node.js - Can two callbacks execute the code at the same time ...
node.js runs Javascript with a single thread. That means that two pieces of Javascript can never be running at the exact same moment....
Read more >5 Rails Callbacks Best Practices Used at Gusto
Instead, try to make callbacks that are idempotent and can be safely run multiple times. This is especially important when you begin moving ......
Read more >Multiple callback in one frame - Unity Forum
Hello guys, I'm starting a new project and I have some issue with the new Input System. I get multiple callbacks in one...
Read more >Unify usage of multiple callbacks · Issue #896 · Lightning-AI ...
Allow having multiple loggers/callbacks for the same training loop. ... uniformly (ie. do the same action at the same time across all the ......
Read more >Active Record Callbacks - Ruby on Rails Guides
With callbacks it is possible to write code that will run whenever an Active Record object is created, saved, updated, deleted, validated, or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have been pondering about my implementation a bit.
So, if I would move the trigger call out of the callback, then I would need to create separate worker methods. Those would do the actual work and when finished trigger the transition to the next state.
Now looking at implementing this, I cannot see another straight-forward approach apart from the “if state A do this, if state B do that”, which you have mentioned in your blog post:
But then again, I started using this package in order to avoid this approach.
Am I missing something here? Do you have more advanced sample code some where?
In my case there are several states with while loops in which another process is polled for information to decide on state transitions depending on the retrieved data.
Closing this and labeling wontfix for now. Still open to ideas though.