Skip to content

Commit

Permalink
Avoid many hass.is_stopping calls in the discovery helper (#99929)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bdraco authored Sep 8, 2023
1 parent 9a45e2c commit bd1d867
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions homeassistant/helpers/discovery_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bd1d867

Please sign in to comment.