aboutsummaryrefslogtreecommitdiffstats
path: root/util/timer.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-02-26 22:17:55 +0000
committerMatthew Wild <mwild1@gmail.com>2009-02-26 22:17:55 +0000
commit0c8bb8e89f63fe33e7a320e5d8bb308c1ba80192 (patch)
treeca9133eb0d1d66d8c9c4fd88d4a87695f248d41c /util/timer.lua
parentd2631d39ca278c6823ffc6e19a670954507c981b (diff)
downloadprosody-0c8bb8e89f63fe33e7a320e5d8bb308c1ba80192.tar.gz
prosody-0c8bb8e89f63fe33e7a320e5d8bb308c1ba80192.zip
util.timer: More small fixes I forgot to commit
Diffstat (limited to 'util/timer.lua')
-rw-r--r--util/timer.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/util/timer.lua b/util/timer.lua
index 8bb1c115..3db66832 100644
--- a/util/timer.lua
+++ b/util/timer.lua
@@ -32,18 +32,16 @@ add_task = _add_task;
ns_addtimer(function()
local current_time = get_time();
if #new_data > 0 then
- for _, d in ipairs(new_data) do
+ for _, d in pairs(new_data) do
t_insert(data, d);
end
new_data = {};
- elseif #data == 0 then
- return;
end
for i, d in pairs(data) do
local t, func = d[1], d[2];
if t <= current_time then
- t_remove(data, i);
+ data[i] = nil;
local r = func();
if type(r) == "number" then _add_task(r, func); end
end