# HG changeset patch # User Kim Alvefur # Date 1638518260 -3600 # Node ID 00c57684cf2087d51ba3aefb04cff15fa746016a # Parent 9d2eab56f12437507b9cee5e037c7ceaf77fcc88 mod_cron: Follow convention of imports at the top diff -r 9d2eab56f124 -r 00c57684cf20 plugins/mod_cron.lua --- a/plugins/mod_cron.lua Fri Dec 03 08:21:29 2021 +0100 +++ b/plugins/mod_cron.lua Fri Dec 03 08:57:40 2021 +0100 @@ -1,6 +1,7 @@ module:set_global(); local async = require("util.async"); +local datetime = require("util.datetime"); local periods = { hourly = 3600; daily = 86400 } @@ -20,7 +21,7 @@ if task.last == nil then task.last = last_run_times:get(nil, task.id); end task.save = save_task; module:log("debug", "%s task %s added, last run %s", task.when, task.id, - task.last and require("util.datetime").datetime(task.last) or "never"); + task.last and datetime.datetime(task.last) or "never"); if task.last == nil and task.when == "daily" then local now = os.time(); task.last = now - now % 86400; diff -r 9d2eab56f124 -r 00c57684cf20 teal-src/plugins/mod_cron.tl --- a/teal-src/plugins/mod_cron.tl Fri Dec 03 08:21:29 2021 +0100 +++ b/teal-src/plugins/mod_cron.tl Fri Dec 03 08:57:40 2021 +0100 @@ -1,6 +1,7 @@ module:set_global(); local async = require "util.async"; +local datetime = require "util.datetime"; local record map_store -- TODO move to somewhere sensible @@ -53,7 +54,7 @@ end task.save = save_task; module:log("debug", "%s task %s added, last run %s", task.when, task.id, - task.last and require"util.datetime".datetime(task.last) or "never"); + task.last and datetime.datetime(task.last) or "never"); if task.last == nil and task.when == "daily" then -- initialize daily tasks to run at ~midnight UTC for now local now = os.time();