So, we just upgraded from 7.9 to 8.0 and most things are working well.
First things first, the online manual has a typo:
https://docs.inductiveautomation.com/display/DOC80/Gateway+Event+Scripts
The timer scripts example has a Hello World example that will not compile
system.util.getLogger(“TestScript”).info.(“Hello”) should be
system.util.getLogger(“TestScript”).info(“Hello”)
To get to the more complicated issue, I’m seeing our Gateway timers executing far more rapidly than they should be. We have some timer tags, that are toggled by Gateway Timer Event Scripts, and these are used for simple tasks like repeating an alert .wav file for Alarming purposes.
After the update, we saw that the timed events were running with no clear periodicity. Investigating, it seems like the scripts are being executed multiple times in the same second, and overwriting each other. To avoid any question about effects of the upgrade, I wrote a brand new gateway timer script, exactly as in the manual, and ran it. It should have written to the logs once per second. Instead, we got 14 executions in 1 second!
Changing the delay has some effects, changing it from 1,000ms to 10,000ms takes us from 14 executions per second to 4 executions per second. Going from 10,000ms to 40,000 gives us… 4 executions per second. 100,000ms gives us 4 executions per second.
What could be causing this?
Finally, system.tag.write() seems to have been deprecated. The manual does not make clear the distinctions between system.tag.writeBlocking() and system.tag.writeAsync(). Can anyone explain them, and which function is the correct choice for a quick, regular write to a ‘timer’ tag, with 1-2 second periodicity?