mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Remove huawei_lte notify related timeout suppression (#148373)
This commit is contained in:
parent
0409c05265
commit
fc53ddb3b4
@ -8,7 +8,6 @@ from contextlib import suppress
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
import time
|
|
||||||
from typing import Any, NamedTuple, cast
|
from typing import Any, NamedTuple, cast
|
||||||
from xml.parsers.expat import ExpatError
|
from xml.parsers.expat import ExpatError
|
||||||
|
|
||||||
@ -78,7 +77,6 @@ from .const import (
|
|||||||
KEY_WLAN_HOST_LIST,
|
KEY_WLAN_HOST_LIST,
|
||||||
KEY_WLAN_WIFI_FEATURE_SWITCH,
|
KEY_WLAN_WIFI_FEATURE_SWITCH,
|
||||||
KEY_WLAN_WIFI_GUEST_NETWORK_SWITCH,
|
KEY_WLAN_WIFI_GUEST_NETWORK_SWITCH,
|
||||||
NOTIFY_SUPPRESS_TIMEOUT,
|
|
||||||
SERVICE_RESUME_INTEGRATION,
|
SERVICE_RESUME_INTEGRATION,
|
||||||
SERVICE_SUSPEND_INTEGRATION,
|
SERVICE_SUSPEND_INTEGRATION,
|
||||||
UPDATE_SIGNAL,
|
UPDATE_SIGNAL,
|
||||||
@ -124,7 +122,6 @@ class Router:
|
|||||||
inflight_gets: set[str] = field(default_factory=set, init=False)
|
inflight_gets: set[str] = field(default_factory=set, init=False)
|
||||||
client: Client = field(init=False)
|
client: Client = field(init=False)
|
||||||
suspended: bool = field(default=False, init=False)
|
suspended: bool = field(default=False, init=False)
|
||||||
notify_last_attempt: float = field(default=-1, init=False)
|
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
"""Set up internal state on init."""
|
"""Set up internal state on init."""
|
||||||
@ -195,19 +192,6 @@ class Router:
|
|||||||
key,
|
key,
|
||||||
)
|
)
|
||||||
self.subscriptions.pop(key)
|
self.subscriptions.pop(key)
|
||||||
except Timeout:
|
|
||||||
grace_left = (
|
|
||||||
self.notify_last_attempt - time.monotonic() + NOTIFY_SUPPRESS_TIMEOUT
|
|
||||||
)
|
|
||||||
if grace_left > 0:
|
|
||||||
_LOGGER.debug(
|
|
||||||
"%s timed out, %.1fs notify timeout suppress grace remaining",
|
|
||||||
key,
|
|
||||||
grace_left,
|
|
||||||
exc_info=True,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
finally:
|
finally:
|
||||||
self.inflight_gets.discard(key)
|
self.inflight_gets.discard(key)
|
||||||
_LOGGER.debug("%s=%s", key, self.data.get(key))
|
_LOGGER.debug("%s=%s", key, self.data.get(key))
|
||||||
|
@ -17,7 +17,6 @@ DEFAULT_UNAUTHENTICATED_MODE = False
|
|||||||
UPDATE_SIGNAL = f"{DOMAIN}_update"
|
UPDATE_SIGNAL = f"{DOMAIN}_update"
|
||||||
|
|
||||||
CONNECTION_TIMEOUT = 10
|
CONNECTION_TIMEOUT = 10
|
||||||
NOTIFY_SUPPRESS_TIMEOUT = 30
|
|
||||||
|
|
||||||
SERVICE_RESUME_INTEGRATION = "resume_integration"
|
SERVICE_RESUME_INTEGRATION = "resume_integration"
|
||||||
SERVICE_SUSPEND_INTEGRATION = "suspend_integration"
|
SERVICE_SUSPEND_INTEGRATION = "suspend_integration"
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from huawei_lte_api.exceptions import ResponseErrorException
|
from huawei_lte_api.exceptions import ResponseErrorException
|
||||||
@ -62,5 +61,3 @@ class HuaweiLteSmsNotificationService(BaseNotificationService):
|
|||||||
_LOGGER.debug("Sent to %s: %s", targets, resp)
|
_LOGGER.debug("Sent to %s: %s", targets, resp)
|
||||||
except ResponseErrorException as ex:
|
except ResponseErrorException as ex:
|
||||||
_LOGGER.error("Could not send to %s: %s", targets, ex)
|
_LOGGER.error("Could not send to %s: %s", targets, ex)
|
||||||
finally:
|
|
||||||
self.router.notify_last_attempt = time.monotonic()
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user