From 1b645c333cd97bacbacbcba135607c48dd549287 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Sun, 20 Feb 2011 17:37:11 +0100 Subject: Fixed the check_schedule() lua function. An misleading error was raised when the function dealt with its last remaining job as it didn't return after removing it. Reviewed-by: Ablu. --- scripts/lua/libmana.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') diff --git a/scripts/lua/libmana.lua b/scripts/lua/libmana.lua index dc58751a..7084216e 100644 --- a/scripts/lua/libmana.lua +++ b/scripts/lua/libmana.lua @@ -342,6 +342,7 @@ end -- them when they are repeated jobs. function check_schedule() if #scheduler_jobs==0 then return end + while os.time() > scheduler_jobs[#scheduler_jobs][0] do -- retreive the job and remove it from the schedule job = scheduler_jobs[#scheduler_jobs] @@ -352,6 +353,10 @@ function check_schedule() end -- execute the job job[1]() + + -- avoid looping on an empty table + if #scheduler_jobs==0 then return end + end end -- cgit v1.2.3-60-g2f50