Comparison

plugins/mod_cron.lua @ 13264:9b720c38fee8

mod_cron: Revert bbd3ac65640d Maybe it is better to run daily and weekly tasks 'now' on the theory that people set these things up during times that are appropriate for maintenance already, so the same time next day or next week might be fine for periodic cleanup.
author Kim Alvefur <zash@zash.se>
date Sun, 30 Jul 2023 13:03:40 +0200
parent 12977:74b9e05af71e
child 13265:6ac5ad578565
comparison
equal deleted inserted replaced
13263:e77994e88940 13264:9b720c38fee8
20 if task.id == nil then task.id = event.source.name .. "/" .. task.name:gsub("%W", "_"):lower(); end 20 if task.id == nil then task.id = event.source.name .. "/" .. task.name:gsub("%W", "_"):lower(); end
21 if task.last == nil then task.last = last_run_times:get(nil, task.id); end 21 if task.last == nil then task.last = last_run_times:get(nil, task.id); end
22 task.save = save_task; 22 task.save = save_task;
23 module:log("debug", "%s task %s added, last run %s", task.when, task.id, 23 module:log("debug", "%s task %s added, last run %s", task.when, task.id,
24 task.last and datetime.datetime(task.last) or "never"); 24 task.last and datetime.datetime(task.last) or "never");
25 if task.last == nil then
26 local now = os.time();
27 task.last = now - now % periods[task.when];
28 end
29 return true 25 return true
30 end 26 end
31 27
32 local function task_removed(event) 28 local function task_removed(event)
33 local task = event.item; 29 local task = event.item;