mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-25 00:38:01 +00:00
Fix P100 errors on multi-requests (#930)
Fixes an issue reported by @bdraco with the P100 not working in the latest branch: `[Errno None] Can not write request body for HOST_REDACTED, ClientOSError(None, 'Can not write request body for URL_REDACTED'))` Issue caused by the number of multi requests going above the default batch of 5 and the P100 not being able to handle the second multi request happening immediately as it closes the connection after each query (See https://github.com/python-kasa/python-kasa/pull/690 for similar issue). This introduces a small wait time on concurrent requests once the device has raised a ClientOSError.
This commit is contained in:
@@ -6,7 +6,6 @@ under compatible GNU GPL3 license.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import hashlib
|
||||
import logging
|
||||
@@ -74,7 +73,6 @@ class AesTransport(BaseTransport):
|
||||
}
|
||||
CONTENT_LENGTH = "Content-Length"
|
||||
KEY_PAIR_CONTENT_LENGTH = 314
|
||||
BACKOFF_SECONDS_AFTER_LOGIN_ERROR = 1
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -216,7 +214,6 @@ class AesTransport(BaseTransport):
|
||||
self._default_credentials = get_default_credentials(
|
||||
DEFAULT_CREDENTIALS["TAPO"]
|
||||
)
|
||||
await asyncio.sleep(self.BACKOFF_SECONDS_AFTER_LOGIN_ERROR)
|
||||
await self.perform_handshake()
|
||||
await self.try_login(self._get_login_params(self._default_credentials))
|
||||
_LOGGER.debug(
|
||||
|
||||
Reference in New Issue
Block a user