Terminate a Running Rule Thread

If they come in bursts, can you wait half a second or so after the last one before generating the message? If so, set a timer on the first one to wait. Reschedule the timer on subsequent events. Only after there have been no events for a second or whatever do you generate the report. It’s the basic [Deprecated] Design Pattern: Motion Sensor Timer.

Note, you may need to put a lock around the creation/check for the Timer if you are on a particularly fast machine or you might end up with a race condition on the creation of the Timer itself and end up with two or more running at the same time. For those running Scripted Automation, the engine itself will prevent more than one copy of the Rule from running at the same time so a lock is not required.

1 Like