Retry BLE service-discovery disconnect errors and bump to 0.1.13
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

This commit is contained in:
paul2212
2026-03-07 15:12:56 +01:00
parent 7778a6f614
commit 42e56e1b9f
6 changed files with 31 additions and 4 deletions

View File

@@ -426,7 +426,16 @@ async def connect(
target = await resolve_ble_target(address)
def _is_retryable_ble_error(exc: Exception) -> bool:
msg = str(exc).lower()
return any(token in msg for token in ("timeout", "timed out", "br-connection-timeout"))
return any(
token in msg
for token in (
"timeout",
"timed out",
"br-connection-timeout",
"failed to discover services",
"device disconnected",
)
)
last_exc: Exception | None = None
for attempt in range(1, BLE_CONNECT_RETRIES + 1):