Delay v Wait advantages?

Can anyone think of a situation where using Delay is superior to using one of the Wait options? Otherwise I am thinking of rewriting all my rules to change delays to waits.

I believe, and I may be wrong as I'm moving away from RM, that a delay will basically stop the execution of all actions that follow the wait until the wait has matured.
The delay will only delay the action it is set against.

action A
wait 10 mins
action B.

Action B will happen 10 minutes after action A.

action A delay 10 minutes
action B

In this scenario action A will happen after 10 mins but action B will happen straight after A has been evaluated.
i.e. straight away. 10 mins before action A.

1 Like

I feel as if that could be a disadvantage rather than an advantage, since if you'd wanted action B to happen first you could have switched the order of the lines, and action A will happen even if the rest of the process is cancelled (eg by a retrigger) even if action B will never run.

I suppose that depends on how you use either wait/delay.

2 Likes

Does anyone have a real life case where delay has worked for them where wait would not?

It could be an advantage, or disadvantage, it really depends on how you need it to work.

A delay if used by itself halts the program and you must make it cancellable and send a cancel delay to halt it,

A wait will automatically be halted when a rule is triggered.

So if you replace a delay directly with a wait for event elapsed time you may get unexpected consequences.

1 Like

I can think of one case where delay might be better than wait. Say you want to know if a fridge door has been open for more than a certain amount of time, because you don't want your fridge to get too warm. So you want a notification when it has been open longer than 2 minutes. Someone else in your family wants to ruin the fridge contents so instead of just leaving the door open, they open and shut it at intervals less than 2 minutes. Then the wait would keep getting cancelled while using delay would get you multiple notifications and you'd really know something weird was going on! But this doesn't sound like a realistic situation.

2 Likes

Here is a use case for a wait.
It gradually steps through the actions so that they occur in sequence at set time intervals.

Summary

image

Here's one for a delay that will get cancelled if the fridge door is closed within the 5 minute timer.

Summary