
Re: Indigo Server 4.1.1 hanging
greennote wrote:I have some Time/Date Action scripts running my Halloween lighting automation, and after several hours, Indigo Server stops responding and the computer eventually becomes completely non-responsive. I can't even force quit any of the open applications. My only recourse is to do a hard reboot of the computer.
I have one scripts which randomly triggers itself every 1-3 seconds and another one which triggers itself every 1-7 seconds. Both use Apple Script for control. I've included them below for you to see.
Any ideas? Anything else you'd like me to provide?
Ok - it appears that you're running these embedded since they have the following line outside the tell to "IndigoServer":
- Code: Select all
set absolute trigger time of time date action theTrigger to tempTriggerTime
That means that you're creating an AppleScript transaction inside the main thread of the IndigoServer and, in the case of the first app, talking to external apps without any timeouts and error handling. This is generally a bad thing to do. Embedded AppleScripts must run on the main thread of the IndigoServer - so if something goes wrong in the script and you don't catch it - Indigo hangs up. Putting stuff inside a transaction grouping with no timeout and error catching is also potentially a problem even if it doesn't communicate with an external app.
So, the first thing you'll want to do is make these scripts external scripts so that they're launched as separate processes from Indigo - that may not stop the hangup, but it's certainly one very obvious potential. Also - you might consider putting all the logic in a stay-open AppleScript that just does random delays between executions rather than have a time/date action kick them off - that would cut down on the AppleScript process startup time, etc., and more fully encapsulate your functionality in one place. When you're talking about scheduling repeating events on the order of seconds apart, it's probably easier to just think about it inside the context of the AppleScript (IMHO).