aboutsummaryrefslogtreecommitdiffstats
path: root/util
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
commit62e023da82e23f87acfaf6ff704d3763376a0b3b (patch)
tree4c84d96d444623ba3811d691dc640d9cb3472e92 /util
parent2efbc0394560daef8accc030af4dadb6a1614828 (diff)
downloadprosody-62e023da82e23f87acfaf6ff704d3763376a0b3b.tar.gz
prosody-62e023da82e23f87acfaf6ff704d3763376a0b3b.zip
util.timer: Fix corner case of timer not repeating if it returns <= 0
Diffstat (limited to 'util')
-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