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:
Kaloyan Naumov
2026-10-04 17:19:05 +03:00
committed by GitHub
parent effdf5a298
commit eed64fe013
4 changed files with 121 additions and 2 deletions

View File

@@ -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}",