-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2024.9 WARNING - Detected blocking call...
#2492
Comments
No comment! |
ChatGPT says that there's no easy way to fix these warnings and gave me this instead: Plan for Reducing Blocking Calls in Home AssistantThis plan outlines a careful approach to reducing blocking calls in the Home Assistant environment, particularly focusing on the 1. Analyze and Identify Blocking Calls
2. Isolate Blocking Sections
async def initialize_ssl_context():
ssl_context = await asyncio.to_thread(create_ssl_context)
return ssl_context
def create_ssl_context():
context = ssl.create_default_context()
context.load_verify_locations(cafile='/path/to/certfile')
return context 3. Refactor the Initialization Process
async def async_setup_entry(hass, config_entry):
ssl_context = await initialize_ssl_context()
login_obj = await asyncio.to_thread(
AlexaLogin,
url=config_entry.data[CONF_URL],
email=config_entry.data[CONF_EMAIL],
password=config_entry.data[CONF_PASSWORD],
ssl_context=ssl_context,
...
)
# Continue with the rest of the async setup 4. Test the Refactored Code
5. Iterate and Optimize
ConclusionThis plan carefully balances the need to reduce blocking operations with the requirement to maintain system stability. By methodically isolating and handling blocking calls, while thoroughly testing and optimizing, we can achieve a more responsive and efficient Home Assistant environment. |
I implemented the following to resolve the warning:
In your opinion, is this a viable alternative to your suggestion? |
Your suggestion is a good idea if alexapy is a library only for Home Assistant. By using Home Assistant’s native methods like |
Detected blocking call...
Detected blocking call...
Detected blocking call...
IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.
Describe the bug
2024.9 causes this error to appear. Haven't investigated, just documenting for now. Causes entire integration to fail to load, however HA believes it loads.
To Reproduce
Expected behavior
Integration loads.
Screenshots
System details
const.py
or HA startup log): 4.12.11pip show alexapy
in homeasssistant container or HA startup log): 1.28.2Debug Logs (alexa_media & alexapy)
Please provide logs.
Additional context
The text was updated successfully, but these errors were encountered: