Handle BLE connect TimeoutError and bump to 0.1.11
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.11
|
||||
|
||||
- Fixed unhandled BLE connect timeout (`asyncio.TimeoutError`) that previously caused HTTP 500 responses.
|
||||
|
||||
## 0.1.10
|
||||
|
||||
- Added automatic BLE reconnect retry with backoff for transient timeout errors (`br-connection-timeout`).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: "Fichero Printer"
|
||||
version: "0.1.10"
|
||||
version: "0.1.11"
|
||||
slug: "fichero_printer"
|
||||
description: "REST API for the Fichero D11s (AiYin) thermal label printer over Bluetooth"
|
||||
url: "https://git.leuschner.dev/Tobias/Fichero"
|
||||
|
||||
@@ -419,6 +419,12 @@ async def connect(
|
||||
await pc.start()
|
||||
yield pc
|
||||
return
|
||||
except asyncio.TimeoutError as exc:
|
||||
last_exc = exc
|
||||
if attempt < BLE_CONNECT_RETRIES:
|
||||
await asyncio.sleep(BLE_CONNECT_BACKOFF * attempt)
|
||||
continue
|
||||
raise PrinterError(f"BLE connection timed out: {exc}") from exc
|
||||
except BleakDBusError as exc:
|
||||
msg = str(exc).lower()
|
||||
if "br-connection-not-supported" in msg:
|
||||
|
||||
Reference in New Issue
Block a user