rules icon indicating copy to clipboard operation
rules copied to clipboard

Perhaps not an issue, but seeking further understanding

Open PeteMilligan99 opened this issue 5 years ago • 4 comments

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

PeteMilligan99 avatar Jun 01 '20 17:06 PeteMilligan99

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.

jruizgit avatar Jun 07 '20 19:06 jruizgit

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.

jruizgit avatar Jun 07 '20 19:06 jruizgit

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?

gone-phishing avatar Sep 07 '20 07:09 gone-phishing

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.

jruizgit avatar Sep 08 '20 02:09 jruizgit