Lock Netgear api during setup (#66033)

This commit is contained in:
starkillerOG 2022-02-08 02:50:38 +01:00 committed by GitHub
parent afd0005a31
commit f9c81dd00b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,8 +123,9 @@ class NetgearRouter:
async def async_setup(self) -> bool: async def async_setup(self) -> bool:
"""Set up a Netgear router.""" """Set up a Netgear router."""
if not await self.hass.async_add_executor_job(self._setup): async with self._api_lock:
return False if not await self.hass.async_add_executor_job(self._setup):
return False
# set already known devices to away instead of unavailable # set already known devices to away instead of unavailable
device_registry = dr.async_get(self.hass) device_registry = dr.async_get(self.hass)