Resolve potential roku setup memory leaks (#49025)

* resolve potential roku setup memory leaks

* Update __init__.py
pull/49106/head
Chris Talkington 2021-04-11 12:35:42 -05:00 committed by GitHub
parent a261bb35eb
commit f7b6d3164a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -47,10 +47,12 @@ async def async_setup(hass: HomeAssistantType, config: dict) -> bool:
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up Roku from a config entry."""
coordinator = RokuDataUpdateCoordinator(hass, host=entry.data[CONF_HOST])
await coordinator.async_config_entry_first_refresh()
coordinator = hass.data[DOMAIN].get(entry.entry_id)
if not coordinator:
coordinator = RokuDataUpdateCoordinator(hass, host=entry.data[CONF_HOST])
hass.data[DOMAIN][entry.entry_id] = coordinator
hass.data[DOMAIN][entry.entry_id] = coordinator
await coordinator.async_config_entry_first_refresh()
for platform in PLATFORMS:
hass.async_create_task(