Comparison

mod_audit_status/mod_audit_status.lua @ 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
parent 5353:14b6397cd6de
child 5864:bd0abf821cef
comparison
equal deleted inserted replaced
5765:645de410dbca 5766:9944c6c3e914
26 }); 26 });
27 store:set_key(nil, "status", "stopped"); 27 store:set_key(nil, "status", "stopped");
28 end); 28 end);
29 29
30 if heartbeat_interval then 30 if heartbeat_interval then
31 local async = require "util.async";
32 local heartbeat_writer = async.runner(function (timestamp)
33 store:set_key(nil, "heartbeat", timestamp);
34 end);
35
31 module:add_timer(0, function () 36 module:add_timer(0, function ()
32 store:set_key(nil, "heartbeat", os.time()); 37 heartbeat_writer:run(os.time());
33 return heartbeat_interval; 38 return heartbeat_interval;
34 end); 39 end);
35 end 40 end