mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix bugs in nest stream expiration handling (#130150)
This commit is contained in:
parent
4a8a674bd3
commit
f7cc91903c
@ -235,7 +235,9 @@ class NestWebRTCEntity(NestCameraBaseEntity):
|
|||||||
async def _async_refresh_stream(self) -> None:
|
async def _async_refresh_stream(self) -> None:
|
||||||
"""Refresh stream to extend expiration time."""
|
"""Refresh stream to extend expiration time."""
|
||||||
now = utcnow()
|
now = utcnow()
|
||||||
for webrtc_stream in list(self._webrtc_sessions.values()):
|
for session_id, webrtc_stream in list(self._webrtc_sessions.items()):
|
||||||
|
if session_id not in self._webrtc_sessions:
|
||||||
|
continue
|
||||||
if now < (webrtc_stream.expires_at - STREAM_EXPIRATION_BUFFER):
|
if now < (webrtc_stream.expires_at - STREAM_EXPIRATION_BUFFER):
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Stream does not yet expire: %s", webrtc_stream.expires_at
|
"Stream does not yet expire: %s", webrtc_stream.expires_at
|
||||||
@ -247,7 +249,8 @@ class NestWebRTCEntity(NestCameraBaseEntity):
|
|||||||
except ApiException as err:
|
except ApiException as err:
|
||||||
_LOGGER.debug("Failed to extend stream: %s", err)
|
_LOGGER.debug("Failed to extend stream: %s", err)
|
||||||
else:
|
else:
|
||||||
self._webrtc_sessions[webrtc_stream.media_session_id] = webrtc_stream
|
if session_id in self._webrtc_sessions:
|
||||||
|
self._webrtc_sessions[session_id] = webrtc_stream
|
||||||
|
|
||||||
async def async_camera_image(
|
async def async_camera_image(
|
||||||
self, width: int | None = None, height: int | None = None
|
self, width: int | None = None, height: int | None = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user