diff options
author | Kim Alvefur <zash@zash.se> | 2021-12-03 08:57:40 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-12-03 08:57:40 +0100 |
commit | 914d3acbd53cc04aac4dc15b3d5efcbbde275f97 (patch) | |
tree | ff4c0f065f6fdd6521f4f53e282f20abe7858de6 | |
parent | 62ff00cd1f65ec585c0f069566bf56c90bcd9bd8 (diff) | |
download | prosody-914d3acbd53cc04aac4dc15b3d5efcbbde275f97.tar.gz prosody-914d3acbd53cc04aac4dc15b3d5efcbbde275f97.zip |
mod_cron: Follow convention of imports at the top
-rw-r--r-- | plugins/mod_cron.lua | 3 | ||||
-rw-r--r-- | teal-src/plugins/mod_cron.tl | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/mod_cron.lua b/plugins/mod_cron.lua index 8d38c227..1255687e 100644 --- a/plugins/mod_cron.lua +++ b/plugins/mod_cron.lua @@ -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 @@ function module.add_host(host_module) 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 --git a/teal-src/plugins/mod_cron.tl b/teal-src/plugins/mod_cron.tl index 078869a9..8d1fa452 100644 --- a/teal-src/plugins/mod_cron.tl +++ b/teal-src/plugins/mod_cron.tl @@ -1,6 +1,7 @@ module:set_global(); local async = require "util.async"; +local datetime = require "util.datetime"; local record map_store<K,V> -- TODO move to somewhere sensible @@ -53,7 +54,7 @@ function module.add_host(host_module : moduleapi) 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(); |