mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Make util.async_.protect_loop name names (#65493)
This commit is contained in:
parent
3e0856ccac
commit
63680f0b36
@ -127,7 +127,7 @@ def check_loop(func: Callable, strict: bool = True) -> None:
|
|||||||
# Did not source from integration? Hard error.
|
# Did not source from integration? Hard error.
|
||||||
if found_frame is None:
|
if found_frame is None:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Detected blocking call inside the event loop. "
|
f"Detected blocking call to {func.__name__} inside the event loop. "
|
||||||
"This is causing stability issues. Please report issue"
|
"This is causing stability issues. Please report issue"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -142,8 +142,9 @@ def check_loop(func: Callable, strict: bool = True) -> None:
|
|||||||
extra = ""
|
extra = ""
|
||||||
|
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Detected blocking call inside the event loop. This is causing stability issues. "
|
"Detected blocking call to %s inside the event loop. This is causing stability issues. "
|
||||||
"Please report issue%s for %s doing blocking calls at %s, line %s: %s",
|
"Please report issue%s for %s doing blocking calls at %s, line %s: %s",
|
||||||
|
func.__name__,
|
||||||
extra,
|
extra,
|
||||||
integration,
|
integration,
|
||||||
found_frame.filename[index:],
|
found_frame.filename[index:],
|
||||||
|
@ -105,8 +105,8 @@ async def test_check_loop_async_integration(caplog):
|
|||||||
):
|
):
|
||||||
hasync.check_loop(banned_function)
|
hasync.check_loop(banned_function)
|
||||||
assert (
|
assert (
|
||||||
"Detected blocking call inside the event loop. This is causing stability issues. "
|
"Detected blocking call to banned_function inside the event loop. This is "
|
||||||
"Please report issue for hue doing blocking calls at "
|
"causing stability issues. Please report issue for hue doing blocking calls at "
|
||||||
"homeassistant/components/hue/light.py, line 23: self.light.is_on"
|
"homeassistant/components/hue/light.py, line 23: self.light.is_on"
|
||||||
in caplog.text
|
in caplog.text
|
||||||
)
|
)
|
||||||
@ -136,8 +136,8 @@ async def test_check_loop_async_integration_non_strict(caplog):
|
|||||||
):
|
):
|
||||||
hasync.check_loop(banned_function, strict=False)
|
hasync.check_loop(banned_function, strict=False)
|
||||||
assert (
|
assert (
|
||||||
"Detected blocking call inside the event loop. This is causing stability issues. "
|
"Detected blocking call to banned_function inside the event loop. This is "
|
||||||
"Please report issue for hue doing blocking calls at "
|
"causing stability issues. Please report issue for hue doing blocking calls at "
|
||||||
"homeassistant/components/hue/light.py, line 23: self.light.is_on"
|
"homeassistant/components/hue/light.py, line 23: self.light.is_on"
|
||||||
in caplog.text
|
in caplog.text
|
||||||
)
|
)
|
||||||
@ -167,9 +167,10 @@ async def test_check_loop_async_custom(caplog):
|
|||||||
):
|
):
|
||||||
hasync.check_loop(banned_function)
|
hasync.check_loop(banned_function)
|
||||||
assert (
|
assert (
|
||||||
"Detected blocking call inside the event loop. This is causing stability issues. "
|
"Detected blocking call to banned_function inside the event loop. This is "
|
||||||
"Please report issue to the custom component author for hue doing blocking calls "
|
"causing stability issues. Please report issue to the custom component author "
|
||||||
"at custom_components/hue/light.py, line 23: self.light.is_on" in caplog.text
|
"for hue doing blocking calls at custom_components/hue/light.py, line 23: "
|
||||||
|
"self.light.is_on" in caplog.text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user