Does [overwrite: false] actually do anything to runIn()?

(Chris LeBlanc) #1

It’s not documented whether this parameter does anything here:

In one of my apps which I hodgepodged together from another app I use runIn(delay, lockTheLocks, [overwrite: false]). I can guess that in this example the runIn() timer would continue counting even if you ran runIn() again but this is speculation since it’s not documented.

Anyone know exactly if and what that parameter would do?

(Ben Edwards) #2

There might be something in the new documetnation to help you out:

And here is an example app that uses the overwrite:false command:

(Chris LeBlanc) #3

Thanks Ben,

Besides the example is the method documented? Otherwise we’re back to square one. I tried flipping through some of the items on the link you guide you sent and couldn’t find runIn().

(Matt Nohr) #4

This is a good question that it looks like we don’t really cover in the docs.

Using [overwrite: false] does change how the underlying scheduling works. When you call runIn(300, 'doSomething'), we schedule it for 5 minutes out. Normally, if in that 5 minute window you call the same runIn(300, 'doSomething') method again we will stop the original schedule and just use the new one. In this case there is at most one schedule for the ‘doSomething’ method.

However, if you were to call runIn(300, 'doSomething', [overwrite: false]), then we let the original schedule continue and also add a new one for another 5 minutes out. This could lead to many different schedules. If you are going to use this, be sure to handle multiple calls to the ‘doSomething’ method.

(Chris LeBlanc) #5

Thanks Matt. Makes sense.