Block detectable I/O in the event loop (#48387)

We added a warning when this happens last April and gave developers
a year to fix the instability. We now prevent the instability by
raising RuntimeError when code attempts to do known I/O in the
event loop instead of the executor.

We now provide a suggestion on how to fix the code that is causing
the issue.
This commit is contained in:
J. Nick Koston 2021-03-26 21:54:49 -10:00 committed by GitHub
parent 63e3012380
commit b50dcef94f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -78,7 +78,7 @@ async def test_check_loop_async():
async def test_check_loop_async_integration(caplog):
"""Test check_loop detects when called from event loop from integration context."""
with patch(
with pytest.raises(RuntimeError), patch(
"homeassistant.util.async_.extract_stack",
return_value=[
Mock(
@ -107,7 +107,7 @@ async def test_check_loop_async_integration(caplog):
async def test_check_loop_async_custom(caplog):
"""Test check_loop detects when called from event loop with custom component context."""
with patch(
with pytest.raises(RuntimeError), patch(
"homeassistant.util.async_.extract_stack",
return_value=[
Mock(