mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-31 17:33:48 +00:00
* Add. Support `onInterval` method to EventConsumer class Usage ```Lua -- execute action each 30 sec events:onInterval(30*1000, function() end) -- execute action once after 5 min events:onIntervalOnce(5*60*1000, function() end) ``` * Fix. Remove timers * Fix. Reset timer before callback It allows stop timer inside callback. Also it produce more accurate interval invocation if callback take quite a long time. E.g. Interval = 10 sec and callback took 5 sec then if we reset timer after this callback then gap between invocation will be 15 sec. * Add. Timers now have TimeEvent class type. Add. `reset` method to IntervalTimer class. ```Lua events:onIntervalOnce(1000, function(self, timer) -- timer has type TimeEvent -- restart timer so it will be invoke again timer:restart() -- or reset new interval -- timer:reset(5000) end) ``` * Fix. Typo in variable name