aboutsummaryrefslogtreecommitdiffstats
path: root/util/timer.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-09-22 15:48:56 +0100
committerMatthew Wild <mwild1@gmail.com>2011-09-22 15:48:56 +0100
commit3f7fda7079b5655fccfd392399d1ff9aebd1a943 (patch)
tree4c84d96d444623ba3811d691dc640d9cb3472e92 /util/timer.lua
parent662e7a289fcc76183346dc072c10c304821f4cf5 (diff)
downloadprosody-3f7fda7079b5655fccfd392399d1ff9aebd1a943.tar.gz
prosody-3f7fda7079b5655fccfd392399d1ff9aebd1a943.zip
util.timer: Fix corner case of timer not repeating if it returns <= 0
Diffstat (limited to 'util/timer.lua')
-rw-r--r--util/timer.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/timer.lua b/util/timer.lua
index 3061da72..642d6e36 100644
--- a/util/timer.lua
+++ b/util/timer.lua
@@ -32,7 +32,10 @@ if not event then
if delay >= current_time then
t_insert(new_data, {delay, func});
else
- func();
+ local r = func();
+ if r and type(r) == "number" then
+ return _add_task(r, func);
+ end
end
end