mirror of
https://github.com/home-assistant/core
synced 2024-07-15 09:42:11 +02: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
|
||||
# Hold lock to prevent concurrent subscription attempts
|
||||
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:
|
||||
for speaker in self.data.discovered.values():
|
||||
|
Loading…
Reference in New Issue
Block a user