mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-10-06 21:03:50 +00:00
Disable multi requests on timeout during multi-request (#1759)
_execute_multiple_query only disables batching on JSON_DECODE_FAIL_ERROR / INTERNAL_UNKNOWN_ERROR (#1025). This change applies the same pattern to a TimeoutError raised while sending a batch: set the batch size to 1 and raise _RetryableError. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import builtins
|
||||
import logging
|
||||
import ssl
|
||||
import time
|
||||
@@ -144,7 +145,9 @@ class HttpClient:
|
||||
raise _ConnectionError(
|
||||
f"Device connection error: {self._config.host}: {ex}", ex
|
||||
) from ex
|
||||
except (aiohttp.ServerTimeoutError, TimeoutError) as ex:
|
||||
# TimeoutError is imported from kasa.exceptions and shadows the builtin,
|
||||
# which is what aiohttp raises when ClientTimeout(total=...) expires.
|
||||
except (aiohttp.ServerTimeoutError, builtins.TimeoutError) as ex:
|
||||
raise TimeoutError(
|
||||
"Unable to query the device, "
|
||||
+ f"timed out: {self._config.host}: {ex}",
|
||||
|
||||
Reference in New Issue
Block a user