mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Log gathered exceptions during Sonos unsubscriptions (#54190)
This commit is contained in:
parent
e558b3463e
commit
87e0b14282
@ -187,8 +187,7 @@ class SonosDiscoveryManager:
|
|||||||
|
|
||||||
async def _async_stop_event_listener(self, event: Event | None = None) -> None:
|
async def _async_stop_event_listener(self, event: Event | None = None) -> None:
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
*(speaker.async_unsubscribe() for speaker in self.data.discovered.values()),
|
*(speaker.async_unsubscribe() for speaker in self.data.discovered.values())
|
||||||
return_exceptions=True,
|
|
||||||
)
|
)
|
||||||
if events_asyncio.event_listener:
|
if events_asyncio.event_listener:
|
||||||
await events_asyncio.event_listener.async_stop()
|
await events_asyncio.event_listener.async_stop()
|
||||||
|
@ -346,10 +346,13 @@ class SonosSpeaker:
|
|||||||
async def async_unsubscribe(self) -> None:
|
async def async_unsubscribe(self) -> None:
|
||||||
"""Cancel all subscriptions."""
|
"""Cancel all subscriptions."""
|
||||||
_LOGGER.debug("Unsubscribing from events for %s", self.zone_name)
|
_LOGGER.debug("Unsubscribing from events for %s", self.zone_name)
|
||||||
await asyncio.gather(
|
results = await asyncio.gather(
|
||||||
*(subscription.unsubscribe() for subscription in self._subscriptions),
|
*(subscription.unsubscribe() for subscription in self._subscriptions),
|
||||||
return_exceptions=True,
|
return_exceptions=True,
|
||||||
)
|
)
|
||||||
|
for result in results:
|
||||||
|
if isinstance(result, Exception):
|
||||||
|
_LOGGER.debug("Unsubscribe failed for %s: %s", self.zone_name, result)
|
||||||
self._subscriptions = []
|
self._subscriptions = []
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user