Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3033,6 +3033,12 @@ def _platform_connect_timeout_secs(self) -> float:
async def _connect_adapter_with_timeout(self, adapter, platform) -> bool:
"""Connect an adapter without allowing one platform to block others."""
timeout = self._platform_connect_timeout_secs()
adapter_timeout = getattr(adapter, "connect_timeout_seconds", None)
if timeout > 0 and adapter_timeout is not None:
try:
timeout = max(timeout, float(adapter_timeout))
except (TypeError, ValueError):
pass
if timeout <= 0:
return await adapter.connect()
try:
Expand Down Expand Up @@ -3494,7 +3500,7 @@ async def _handle_adapter_fatal_error(self, adapter: BasePlatformAdapter) -> Non
self._failed_platforms[adapter.platform] = {
"config": platform_config,
"attempts": 0,
"next_retry": time.monotonic() + 30,
"next_retry": time.monotonic(),
}
logger.info(
"%s queued for background reconnection",
Expand Down Expand Up @@ -6361,8 +6367,11 @@ async def _platform_reconnect_watcher(self) -> None:
for _ in range(30):
if not self._running:
return
if self._failed_platforms:
break
await asyncio.sleep(1)
continue
if not self._failed_platforms:
continue

now = time.monotonic()
for platform in list(self._failed_platforms.keys()):
Expand Down
Loading