Added debug logging by sending heartbeats.

This commit is contained in:
2026-06-08 07:41:13 +08:00
parent c61ffe2f75
commit 6311ddee17
+3
View File
@@ -11,8 +11,10 @@ class SystemdNotifier
MethodExecutor.record("error", "heartbeat", "NOTIFY_SOCKET is not set or is not a socket, am I a service?")
@enable_heartbeat = false
else
MethodExecutor.record("debug", "heartbeat", "Found NOTIFY_SOCKET, enabling heartbeat")
@enable_heartbeat = true
@socket = UNIXSocket.new(@notify_socket)
MethodExecutor.record("debug", "heartbeat", "Heartbeat socket opened")
end
def enabled?
@@ -24,6 +26,7 @@ class SystemdNotifier
begin
@socket.send(message, 0)
MethodExecutor.record("debug", "heartbeat", "Heartbeat sent: #{message}")
rescue => e
MethodExecutor.error("heartbeat", "Failed to send heartbeat: #{e}")
@enable_heartbeat = false