From f9eb22beb1d55f7f615cf05df6186ca85cf98bbf Mon Sep 17 00:00:00 2001 From: cfdaily Date: Thu, 21 May 2026 12:26:45 +0800 Subject: [PATCH] auto-sync: 2026-05-21 12:26:45 --- src/daemon/counter.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/daemon/counter.py b/src/daemon/counter.py index ba095b9..4ecca6d 100644 --- a/src/daemon/counter.py +++ b/src/daemon/counter.py @@ -68,6 +68,14 @@ class ActiveAgentCounter: def global_active(self) -> int: return self._global_active + @property + def max_global(self) -> int: + return self._max_global + @property def active_agents(self) -> Dict[str, int]: return dict(self._active) + + def is_near_limit(self, margin: int = 1) -> bool: + """全局活跃数是否接近上限""" + return self._global_active >= self._max_global - margin