rules
rules copied to clipboard
Perhaps not an issue, but seeking further understanding
Hi Jesus, We're planning to apply your rules solution in Node.Js to Time-series data. It looks perfect for that. esp. as we can store state in Redis.
I am a little confused when running a very simple demo: `var d = require('durable');
d.ruleset('test', function() { // antecedent whenAll: m.subject == 'World' // consequent run: console.log('Hello ' + m.subject) });
d.post('test', {subject: 'World'});`
that this doesn't gracefully exit to the command-line. I could 'process.exit()', but sense that you have a Daemon/async/Queue operation for firing the events. Do you see a way in which, after posting (d.post) data we can reliably exit after all rules have been processed?
Using Windows 10 64 bit, Node 12.17, durable 2.0.34
Thanks, Pete
Hi Pete, thanks for asking the question. This is a good point, I haven't implemented a method to gracefully tear down the background threads. Let me work on that.
One note: when using redis to store state, non-graceful exit should not lead to data inconsistency, provided the rules actions don't side-effect outside the rules state.
Hi @jruizgit facing similar issue in python as well where in case of an exception, multiple threads are being spawned in an infinite loop kind of way. Do you think the closing of background threads needs some changes for python part as well?
Hi, would you mind providing sample code of your case so I can debug? Exceptions should not lead to infinite loops. However, when an exception is thrown, the rules engine will try to execute the action again.