diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-02-20 17:37:11 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-02-20 21:49:17 +0100 |
commit | 1b645c333cd97bacbacbcba135607c48dd549287 (patch) | |
tree | 1f534c81a183cb8fc2a13209a262fe3c2ddb2d25 /scripts | |
parent | 1f2d9d4723d3fb4973f11764fed0063757b8f3a4 (diff) | |
download | manaserv-1b645c333cd97bacbacbcba135607c48dd549287.tar.gz manaserv-1b645c333cd97bacbacbcba135607c48dd549287.tar.bz2 manaserv-1b645c333cd97bacbacbcba135607c48dd549287.tar.xz manaserv-1b645c333cd97bacbacbcba135607c48dd549287.zip |
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.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lua/libmana.lua | 5 |
1 files changed, 5 insertions, 0 deletions
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 |