Avoid many hass.is_stopping calls in the discovery helper (#99929)

async_has_matching_flow is more likely to be True than hass.is_stopping

This does not make much difference but it was adding noise to a profile
that I am digging into to look for another issue
pull/99955/head
J. Nick Koston 2023-09-08 12:09:29 -05:00 committed by GitHub
parent 9a45e2cf91
commit bd1d8675a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -44,8 +44,9 @@ def _async_init_flow(
# as ones in progress as it may cause additional device probing
# which can overload devices since zeroconf/ssdp updates can happen
# multiple times in the same minute
if hass.is_stopping or hass.config_entries.flow.async_has_matching_flow(
domain, context, data
if (
hass.config_entries.flow.async_has_matching_flow(domain, context, data)
or hass.is_stopping
):
return None