Software /
code /
prosody-modules
Changeset
5766:9944c6c3e914
mod_audit_status: Support writing heartbeat with async storage drivers
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 29 Nov 2023 12:14:49 +0000 |
parents | 5765:645de410dbca |
children | 5767:b4607c5dfcac |
files | mod_audit_status/mod_audit_status.lua |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_audit_status/mod_audit_status.lua Wed Nov 29 11:14:21 2023 +0100 +++ b/mod_audit_status/mod_audit_status.lua Wed Nov 29 12:14:49 2023 +0000 @@ -28,8 +28,13 @@ end); if heartbeat_interval then + local async = require "util.async"; + local heartbeat_writer = async.runner(function (timestamp) + store:set_key(nil, "heartbeat", timestamp); + end); + module:add_timer(0, function () - store:set_key(nil, "heartbeat", os.time()); + heartbeat_writer:run(os.time()); return heartbeat_interval; end); end