refactor: 修复潜在bug、补全许可声明、添加类型注解、同步文档

This commit is contained in:
2026-06-08 11:35:51 +08:00
parent b43527c52e
commit 60176fa316
10 changed files with 138 additions and 14 deletions
+4 -1
View File
@@ -35,17 +35,20 @@ class SystemdNotifier
MethodExecutor.record("debug", "heartbeat", "Heartbeat socket opened")
end
# @return [Boolean]
def enabled?
@enable_heartbeat
end
# @param message [String]
# @return [void]
def self.notify(message)
return unless @enable_heartbeat
begin
@socket.send(message, 0)
MethodExecutor.record("debug", "heartbeat", "Heartbeat sent: #{message}")
rescue => e
MethodExecutor.error("heartbeat", "Failed to send heartbeat: #{e}")
MethodExecutor.record("error", "heartbeat", "Failed to send heartbeat: #{e}")
@enable_heartbeat = false
end
end