FYI for those using the runIn() command - BUG


(Apostlepd) #1

If you’re using the runIn() command, you must add an “unschedule(“abc”)” command BEFORE the runIn(x, “abc”) in order to make it work. Here’s an example:

def motionActiveHandler(evt) {
unschedule(“myNewEvent”)
runIn(60, “myNewEvent”)
}

def myNewEvent(evt) {
switch1.on()
}

this will run “myNewEvent” (turning on a switch) 60 seconds after the “motionActiveHandler(evt)” has been called.
You must include the unschedule() command or it won’t work. At least it never worked for me until I added that command.

Hopefully this will help someone.


(Matty & Troy) #2

This bug still exists - but the above fix one occasionally works.

I still quite often see a runIn job fired several times.

Is there a proper fix / workaround for this yet?


(Alex) #3

I lost several hours trying to figure this out too. Neither “runIn” nor “schedule” work well for me in the simulator, I didn’t have a chance to confirm how well these commands work in actual app.

In my experience, the scheduled jobs die eventually after a random number of executions.

Some of the sample apps have this workaround in them too. So this mush be a known bug. I wish it was known to all.