LC.timeout.*¶
The module LC.timeout allows calling Lua functions with a delay.
-
LC.timeout.set(command, min, max)¶ -
- Arguments
-
-
command (String) – Lua command to call
-
min (Number) – minimum time to wait
-
max (Number) – maximum time to wait
-
A timer is set to call
commandwith a delay. The call is made at the earliest afterminseconds, at the latest aftermaxseconds. Calling this function again with the samecommandwill reset the internal timer unless themaxvalue has been reached.This function is used for example when an idempotent program is to be executed, but several successive calls within a short timeframe should be avoided.
The function name passed in
commandmust be available in all Lua instances in the global namespace and can not accept any parameters.
Example
In this example, the function apache.reload is executed at least 10 seconds after the last call to LC.timeout.set(), but no later than 60 seconds after the first call:
LC.timeout.set('apache.reload', 10, 60)