`get_triggers` doesn't check conditions
See original GitHub issueMachine.get_triggers
doesn’t check conditions, and so returns triggers that can’t actually be called.
Generally, there is no mechanism to check upon a transition’s conditions before actually trying to apply it.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
mysql - Trigger can't work properly when check condition
The problem is in product_stock table, INSERT query doesn't work when product record not exist, but update query work does properly when product ......
Read more >Workflow Automation - How to get Triggers Conditions to combine ...
I currently have an automation set up across all our pipelines so that anytime a project stage is changed to 'confirmed' , the...
Read more >Triggers - AWS Glue - AWS Documentation
... An array of Condition objects. A list of the conditions that determine when the trigger will fire. ... GetTriggers action (Python: get_triggers)....
Read more >Trigger Conditions doesn't work - Power Platform Community
This example works with versioning (make sure that this is enabled on your list). In this example we will check if the value...
Read more >Java API: Condition Class Reference - Kanzi documentation
Check function for condition. void, close (). Close the object, and release native resources. Trigger · getTrigger (). Returns the pointer to a...
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
This thread is a little old now but I found the solution that @aleneum gave to be very helpful for my use case and I wanted to point out a small problem i ran into. The can_trigger function will return triggers that are not valid if they share the same name as valid triggers from a different source state. These should not be taken into account since we know what our current state is.
I think these transitions will reveal the error. If our model is in state “B” can_trigger will still return go_A even though the successful transition does not apply because it requires us to be in state “C”.
I think this should fix it
Hi @benselme,
EventData
is a collection of data relevant for the transition which you can create on the fly as you can see in the following example.PeekMachine
is based on your initial idea (thanks for that) and adds acan_trigger
method to each model for convenience.