From feff713e0a72707f5db4e3c88e12b77aa180e0c3 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Tue, 26 May 2026 08:26:12 +0800 Subject: [PATCH] auto-sync: 2026-05-26 08:26:12 --- src/daemon/ticker.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index 8c526c5..0c8c821 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -671,6 +671,16 @@ class Ticker: """从 Dispatcher 获取 counter""" return getattr(self.dispatcher, 'counter', None) if self.dispatcher else None + @staticmethod + def _is_pid_alive(pid: int) -> bool: + """检查进程是否存活""" + import os + try: + os.kill(pid, 0) + return True + except (ProcessLookupError, PermissionError): + return False + def _get_idle_agents(self) -> List[str]: """获取当前空闲的 Agent 列表(从 config agents 取,而非 counter._per_agent)""" if not self.counter: