You can use nginx.lua timers for that. Please have a look into the documentation, it is really well documented. Also look at https://github.com/openresty/lua-resty-upstream-healthcheck for an example.
On Saturday, September 17, 2016 at 3:01:43 AM UTC+2, Don Bozarth wrote:
How can I have a Lua script continuously loop. Example:
I am building a system that will monitor the state of external switches from devices. In order to catch the state change I would need to create an event loop that every so often would check the state. If the state changes then do something.
I may want a sequence of things to happen if the state changes. Then return and the loop continues. Like scan.
I may need several loops all running simultaneously watching various things. Returning variables etc.
I have never run Lua as server app. But know Lua quite well. I use it now for controlling industrial machines like a PLC.
Any help is appreciated.