Long sleep ok?

Normally, I put a timer in rules that needs some longer wait, but in this particular case, I think it would be simplest to just sleep for a minute or two. Is this bad? Could it clog something up, and what happens if there are multiple rule triggers happening while sleeping, will they be queued up, or wasted?

The actual snippet is that I want to add a the coffe drip time before announcing it is ready. (I know, important rules, right?! :smile: )

if ( coffemaker_on == 1 )
  var String message = "Kaffet är klart!"

And putting that into a timer seams much more complicated.

After some more tests, maybe putting this in a timer isn’t too complicated, as long as I also put the message string into the timer, which I did not first try.
But the question is anyway intresting, (what happens with incoming triggers etc).

This is clearly what timers are meant for and it is indeed very easy to use them.
With sleep, you are blocking a whole thread for all of the time and you might run out of available threads (as usually pools are used for such executions).

Aha, so if I’m understanding you correctly, a new trigger would start a new instance (thread) of the same rule, while the first was in its sleep?


Thank you for clearing this out! That was the missing puzzle bit for me! :slight_smile: