Mercurial > prosody-modules
changeset 6378:5a76973e4304
mod_http_host_status_check: Switch to prosody.util.time.now() to get the current time
| author | Link Mauve <linkmauve@linkmauve.fr> |
|---|---|
| date | Fri, 30 Jan 2026 15:04:03 +0100 |
| parents | 032445730eaa |
| children | f16c0b5e4fa6 |
| files | mod_http_host_status_check/mod_http_host_status_check.lua |
| diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_host_status_check/mod_http_host_status_check.lua Fri Jan 30 15:03:56 2026 +0100 +++ b/mod_http_host_status_check/mod_http_host_status_check.lua Fri Jan 30 15:04:03 2026 +0100 @@ -2,7 +2,7 @@ local events = module:shared("/*/host_status_check/connection_events"); local host_status_ok = module:shared("host_status_ok"); -local time = require "socket".gettime; +local time = require "prosody.util.time".now; local template = require "util.interpolation".new("%b{}", function (s) return s end) module:depends "http" @@ -39,11 +39,11 @@ for host in pairs(hosts) do local last_heartbeat_time = heartbeats[host]; - + local ok, status_text = true; - + local is_component = hosts[host].type == "component" and hosts[host].modules.component; - + if is_component then local current_status = hosts[host].modules.component.connected; if events[host] then @@ -84,7 +84,7 @@ all_ok = false; table.insert(failed_hosts, host); end - + if not ok or is_component or last_heartbeat_time then host_statuses[host] = string_pad(status_text, 20); end
