RM Feature Request: Prevent rule from triggering if already running

So I know I've asked for this feature before, and so have others, but I'm going to ask again now that there is a "simpler" method to implement it. My suggestion is to utilise the existing Required Expression with Private Boolean's. eg

I know I'm being somewhat lazy, but having to manually configure this every time I write or modify a rule gets tiresome. I'd really love this to be as easy as enabling a slider.

@bcopeland

4 Likes
1 Like

I honestly disagree with that ā€œexplanationā€ from Bruce, all rules have a start and end, if they didn’t they’d be running in an infinite loop.

I think Bruce is correct that it would be problematic to cover all scenarios. However, if it only covered the most basic scenario, if the rule is triggered and executing do not trigger again, would that be doable? That is the most common use.

3 Likes

If the rules had "Goto" line instruction then all exits could go through that line!

Or if that's too primitive, how about a specific setting for an exit instruction that is always executed upon exit.

1 Like

I don't know the details but suspect it's not as straightforward as we might think. As an example, you can "Cancel Rule Timers" from another rule.

This is exactly what I’m suggesting.

I see what you are saying, but even in this scenario, the rule has a clear termination point.

Even if a rule is complex and has half a dozen ā€œexit ruleā€ provisions, they are still exit points.

Bruce is a great programmer, surely he hasn’t written rule machine with no way to see when a rule runs and exits?

Personally, I’d have thought that under the hood of RM there was an ā€œexit ruleā€ subroutine that is called whenever a rule completes or is canceled.

Honestly, I’m a bit shocked at the suggestion that this may not be the case. :scream:

If that is a true fact, then a ā€œsingle threadedā€ option should be simple to add.
I.e., ignore all triggers while rule is ā€œrunningā€.

2 Likes

One scenario I wonder about is if you call another rules actions would that cause an issue?

Can you provide an example? I don’t understand why or how anyone would want to do this?

I agree with the idea of a toggle for this. Private Booleans give a lot more flexibility - for example you can set booleans for another rule and have a rule that runs only once until reset by a different rule.

But a single button for "allow only one instance of this rule to run" would definitely be awesome.

4 Likes

I don't have a specific example, but it is possible. You can run the actions of other rules in RM, so I just wondered if you did that how it might impact this scenario.

I’m having trouble finding where ā€œrun rule actionsā€ is documented.
Is it more equivalent to a subroutine call or a ā€œgo toā€?

I cant even figure out how this is even possible - not even custom actions appear to support this?

EDIT: NVM, I found it, but this seems like a recipe for a logical disaster to my non-dev brain...

EDIT 2: NVM, I realised it's just bypassing the triggers for that rule.

1 Like

I know how to enter it, just can’t find description of how it works!
It appears to fire off a new thread to run those actions but are they run in parallel with calling rule or does calling rule wait for ā€œreturnā€?

1 Like

Good question.

Correct. It just runs the actions from the rule bypassing other steps. In fact, I have a lot of "Rules" without triggers at all, I just call the actions from other rules.

One thing I haven't actually looked into yet is - if a rule has a Required Expression that is currently False, will Run Rule Actions bypass the required expression and run the rules, or is the required expression still "required" for the actions to be run.. Can anybody confirm?

3 Likes

I always pictured that call as ignoring everything above the rule's Actions section (i.e. Triggers and Req's Expressions), but it's a good question -- although some of my called rules have triggers too (like you, some don't), I don't think I have any with Req'd Expressions...

Would be nice to confirm that answer either way.