runIn polling seems to die after a while, how do I fix it?

Hello,

At line 103 in my RelayBoard-app.groovy, I am calling "runIn" from the Install(), which is also called from Update(). This works for about a few months. Then I find it dead. The polling is not running. When I go to the App settings and click done, that seems to call Initialize() again and the polling resumes. By the time I notice, the logs have been lost. So not sure if it's getting an error or what. Otherwise, it runs fantastic!

What can I do to make this resilient? Am I calling the polling from the wrong place? Is there a watchdog I could implement to make sure the polling is not dead?

Thanks.

Instead of stringing runIn()s together, just use schedule() instead, for whatever frequency you want. You can use a cron string to set it up.

@bravenel Oh, that sounds much better! I will look for some examples and documents tonight!

@bravenel thanks a lot for the advice. I used the schedule command with the cron string as you suggested. I updated the code and pushed to github. Works perfectly, but only time will tell. The old one was not terrible. The old way would run for a couple months. Hopefully, I will never have to touch this again...

1 Like