Formatting and remove debug logging

This commit is contained in:
AliasAlreadyTaken 2024-04-13 03:47:32 +02:00
parent 89c33814f9
commit c5ed295d69
2 changed files with 6 additions and 5 deletions

View File

@ -177,7 +177,6 @@ local function clean_executed_tasks()
local amount_deleted = 0
for i = #tasks, 1, -1 do
core.log("action",tasks[i].id)
if ((tasks[i].done ~= nil) and (tasks[i].done > 0)) then
local UUID = tasks[i].id
table.remove(tasks, i)
@ -208,7 +207,7 @@ function yl_scheduler.clean_executed_tasks() return clean_executed_tasks() end
local function execute_task(UUID)
local _, task = yl_scheduler.get_task(UUID)
local f = string.split(task.func,".")
local f = string.split(task.func, ".")
local func = _G
for _, part in ipairs(f) do
@ -219,7 +218,7 @@ local function execute_task(UUID)
-- Execute the function
if func and (type(func) == "function") then
local success, message = pcall(func,unpack(task.params or {}))
local success, message = pcall(func, unpack(task.params or {}))
if not success then return false, "Pcall " .. message end
else
-- remove from list, so that it won't get exectured over and over

View File

@ -8,13 +8,15 @@ local gs = function(dtime)
local _, tasks = yl_scheduler.list_all_tasks()
local current_utc_time = os.time(os.date("!*t"))
for _, task in ipairs(tasks) do
if (task.at < current_utc_time) and ((task.done == nil) or (task.done == -1)) then
if (task.at < current_utc_time) and
((task.done == nil) or (task.done == -1)) then
local UUID = task.id
local success, message = yl_scheduler.execute_task(UUID)
if (success == false) then
minetest.log("warning", "[MOD] yl_scheduler : " .. dump(message))
else
minetest.log("action", "[MOD] yl_scheduler : Executed " .. dump(task.id))
minetest.log("action",
"[MOD] yl_scheduler : Executed " .. dump(task.id))
end
end
end