Dont cache integrations that are not found (#23316)
parent
34c03109e5
commit
d5bd8b9405
|
@ -161,11 +161,13 @@ async def async_get_integration(hass: 'HomeAssistant', domain: str)\
|
|||
await int_or_evt.wait()
|
||||
int_or_evt = cache.get(domain, _UNDEF)
|
||||
|
||||
if int_or_evt is _UNDEF:
|
||||
pass
|
||||
elif int_or_evt is None:
|
||||
raise IntegrationNotFound(domain)
|
||||
else:
|
||||
# When we have waited and it's _UNDEF, it doesn't exist
|
||||
# We don't cache that it doesn't exist, or else people can't fix it
|
||||
# and then restart, because their config will never be valid.
|
||||
if int_or_evt is _UNDEF:
|
||||
raise IntegrationNotFound(domain)
|
||||
|
||||
if int_or_evt is not _UNDEF:
|
||||
return cast(Integration, int_or_evt)
|
||||
|
||||
event = cache[domain] = asyncio.Event()
|
||||
|
@ -197,7 +199,12 @@ async def async_get_integration(hass: 'HomeAssistant', domain: str)\
|
|||
return integration
|
||||
|
||||
integration = Integration.resolve_legacy(hass, domain)
|
||||
cache[domain] = integration
|
||||
if integration is not None:
|
||||
cache[domain] = integration
|
||||
else:
|
||||
# Remove event from cache.
|
||||
cache.pop(domain)
|
||||
|
||||
event.set()
|
||||
|
||||
if not integration:
|
||||
|
|
Loading…
Reference in New Issue