Software /
code /
prosody
Changeset
12000:00c57684cf20
mod_cron: Follow convention of imports at the top
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 03 Dec 2021 08:57:40 +0100 |
parents | 11999:9d2eab56f124 |
children | 12001:5a8c6f9a4583 |
files | plugins/mod_cron.lua teal-src/plugins/mod_cron.tl |
diffstat | 2 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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<K,V> -- 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();