changeset 5840:bd0abf821cef

mod_audit_status: Expose 'crashed' flag
author Matthew Wild <mwild1@gmail.com>
date Tue, 20 Feb 2024 17:11:42 +0000
parents fba64b043c52
children 904b226fddf1
files mod_audit_status/mod_audit_status.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_audit_status/mod_audit_status.lua	Thu Feb 15 09:20:50 2024 -0800
+++ b/mod_audit_status/mod_audit_status.lua	Tue Feb 20 17:11:42 2024 +0000
@@ -9,10 +9,14 @@
 
 local store = module:open_store(nil, "keyval+");
 
+-- This is global, to make it available to other modules
+crashed = false; --luacheck: ignore 131/crashed
+
 module:hook_global("server-started", function ()
 	local recorded_status = store:get();
 	if recorded_status and recorded_status.status == "started" then
 		module:audit(nil, "server-crashed", { timestamp = recorded_status.heartbeat });
+		crashed = true;
 	end
 	module:audit(nil, "server-started");
 	store:set_key(nil, "status", "started");