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

@@ -1,3 +1,4 @@
import builtins
import re
import aiohttp
@@ -35,6 +36,13 @@ from kasa.httpclient import HttpClient
TimeoutError,
"Unable to query the device, timed out: ",
),
# aiohttp raises the builtin TimeoutError when ClientTimeout(total=...)
# expires after the connection is established.
(
builtins.TimeoutError(),
TimeoutError,
"Unable to query the device, timed out: ",
),
(Exception(), KasaException, "Unable to query the device: "),
(
aiohttp.ServerFingerprintMismatch(b"exp", b"got", "host", 1),
@@ -47,6 +55,7 @@ from kasa.httpclient import HttpClient
"ClientOSError",
"ServerTimeoutError",
"TimeoutError",
"BuiltinTimeoutError",
"Exception",
"ServerFingerprintMismatch",
),