mirror of
https://github.com/home-assistant/core.git
synced 2025-06-24 06:57:08 +00:00
Cleanup Sonos subscription used during setup (#106575)
This commit is contained in:
parent
90744b0a8e
commit
ad199aaba2
@ -290,6 +290,17 @@ class SonosDiscoveryManager:
|
|||||||
sub.callback = _async_subscription_succeeded
|
sub.callback = _async_subscription_succeeded
|
||||||
# Hold lock to prevent concurrent subscription attempts
|
# Hold lock to prevent concurrent subscription attempts
|
||||||
await asyncio.sleep(ZGS_SUBSCRIPTION_TIMEOUT * 2)
|
await asyncio.sleep(ZGS_SUBSCRIPTION_TIMEOUT * 2)
|
||||||
|
try:
|
||||||
|
# Cancel this subscription as we create an autorenewing
|
||||||
|
# subscription when setting up the SonosSpeaker instance
|
||||||
|
await sub.unsubscribe()
|
||||||
|
except ClientError as ex:
|
||||||
|
# Will be rejected if already replaced by new subscription
|
||||||
|
_LOGGER.debug(
|
||||||
|
"Cleanup unsubscription from %s was rejected: %s", ip_address, ex
|
||||||
|
)
|
||||||
|
except (OSError, Timeout) as ex:
|
||||||
|
_LOGGER.error("Cleanup unsubscription from %s failed: %s", ip_address, ex)
|
||||||
|
|
||||||
async def _async_stop_event_listener(self, event: Event | None = None) -> None:
|
async def _async_stop_event_listener(self, event: Event | None = None) -> None:
|
||||||
for speaker in self.data.discovered.values():
|
for speaker in self.data.discovered.values():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user