attempt to renew subscription immediately to stop endless loop if it fails after setup (#42651)

This commit is contained in:
Jason Hunter 2020-10-31 09:15:11 -04:00 committed by GitHub
parent c7ba2341e3
commit f1bb7b4a0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,6 +74,14 @@ class EventManager:
async def async_start(self) -> bool: async def async_start(self) -> bool:
"""Start polling events.""" """Start polling events."""
if await self.device.create_pullpoint_subscription(): if await self.device.create_pullpoint_subscription():
# Create subscription manager
self._subscription = self.device.create_subscription_service(
"PullPointSubscription"
)
# Renew immediately
await self.async_renew()
# Initialize events # Initialize events
pullpoint = self.device.create_pullpoint_service() pullpoint = self.device.create_pullpoint_service()
try: try:
@ -87,11 +95,6 @@ class EventManager:
# Parse event initialization # Parse event initialization
await self.async_parse_messages(response.NotificationMessage) await self.async_parse_messages(response.NotificationMessage)
# Create subscription manager
self._subscription = self.device.create_subscription_service(
"PullPointSubscription"
)
self.started = True self.started = True
return True return True