fix: move class-level attribute after docstring, clarify throttle comment
Follow-up nits for salvaged PR #4577: - Move _running_agents_ts class attribute below the docstring so GatewayRunner.__doc__ is preserved. - Add clarifying comment explaining the throttle continue behavior (batches queued messages during the throttle interval).
This commit is contained in:
@@ -446,16 +446,16 @@ def _resolve_hermes_bin() -> Optional[list[str]]:
|
|||||||
|
|
||||||
|
|
||||||
class GatewayRunner:
|
class GatewayRunner:
|
||||||
# Class-level defaults so partial construction in tests doesn't
|
|
||||||
# blow up on attribute access.
|
|
||||||
_running_agents_ts: Dict[str, float] = {}
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Main gateway controller.
|
Main gateway controller.
|
||||||
|
|
||||||
Manages the lifecycle of all platform adapters and routes
|
Manages the lifecycle of all platform adapters and routes
|
||||||
messages to/from the agent.
|
messages to/from the agent.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Class-level defaults so partial construction in tests doesn't
|
||||||
|
# blow up on attribute access.
|
||||||
|
_running_agents_ts: Dict[str, float] = {}
|
||||||
|
|
||||||
def __init__(self, config: Optional[GatewayConfig] = None):
|
def __init__(self, config: Optional[GatewayConfig] = None):
|
||||||
self.config = config or load_gateway_config()
|
self.config = config or load_gateway_config()
|
||||||
@@ -5466,6 +5466,9 @@ class GatewayRunner:
|
|||||||
_now = time.monotonic()
|
_now = time.monotonic()
|
||||||
_remaining = _PROGRESS_EDIT_INTERVAL - (_now - _last_edit_ts)
|
_remaining = _PROGRESS_EDIT_INTERVAL - (_now - _last_edit_ts)
|
||||||
if _remaining > 0:
|
if _remaining > 0:
|
||||||
|
# Wait out the throttle interval, then loop back to
|
||||||
|
# drain any additional queued messages before sending
|
||||||
|
# a single batched edit.
|
||||||
await asyncio.sleep(_remaining)
|
await asyncio.sleep(_remaining)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user