[v3.1.0] RulesEngine does not update the compiled rules atomically.
See original GitHub issueStarting this thread to discuss the synchronization issue due to the compiled rule not updated atomically.
Current Workaround
We need to perform:
- RulesEngine.RemoveWorkflow(string workflowName) and
- RulesEngine.AddWorkflow(WorkflowRules[] workflowRules) in sequence to clear the compiled rules (
_compileRules
) in RulesCache.cs. - The compiled rules are then refreshed when we call
RulesEngine.ExecuteAllRulesAsync(string workflowName, params RuleParameter[] ruleParams)
(see [1], [2], [3]).
Synchronization Issue
Caller needs to synchronize the incoming requests for a worflow name by SemaphoreSlim lock (or equivalent) when they need to execute rules via the above three operations otherwise workflow rules may not be executed say if one of the requests is trying to ExecuteAllRulesAsync
while the other request is RulesEngine.RemoveWorkflow
.
Proposed
Provide an atomic way to update the (_compileRules
) in RulesCache.cs by a new method RulesEngine.AddOrUpdateWorkflowRules(WorkflowRules[] workflowRules, params Type[] type)
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
CHANGELOG.md - microsoft/RulesEngine
Cache system added so that rules compilation is stored and thus made more efficient. Fix. Concurrency issue which arose by dictionary was resolved....
Read more >Highest scored 'drools' questions
I understand that Drools is Open Source and JESS is not, but how do they compare in ... 3 answers ... Expert/Rule Engine...
Read more >microsoft/RulesEngine: A Json based Rules Engine ...
Here, workflow is a list of deserialized objects based on the schema explained above Once initialised, the Rules Engine needs to execute the...
Read more >Drools Documentation
Drools is a business rule management system with a forward-chaining and backward-chaining inference based rules engine, allowing fast and reliable evaluation of ...
Read more >Drools Documentation - Red Hat on GitHub
You may use drools-compiler to produce rule packages "out of process", and then deploy them to a runtime system. This runtime system only...
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 Free
Top 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
this has been fixed in v3.2.0
We don’t have any strict cadence, as for this new change, we should be good to release by 9th or 10th June