Skip to content
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

Blocks the all processes for 3 seconds every 10 if the vacuum is offline #8

Closed
dbuezas opened this issue Mar 11, 2024 · 0 comments · Fixed by #9
Closed

Blocks the all processes for 3 seconds every 10 if the vacuum is offline #8

dbuezas opened this issue Mar 11, 2024 · 0 comments · Fixed by #9

Comments

@dbuezas
Copy link
Contributor

dbuezas commented Mar 11, 2024

This was driving me nuts.
After enabling debugpy: and hacking the maximum log text length, I got this every 10 seconds.

2024-03-11 22:17:22.884 WARNING (MainThread) [asyncio] Executing <TimerHandle when=272320.416692397 _run_async_call_action(<HomeAssistant RUNNING>, <Job EntityPlatform poll media_player.sox: track time interval 10.0 <bound method EntityPlatform._async_handle_interval_callback of <EntityPlatform domain=media_player platform_name=sox config_entry=None>> HassJobType.Callback <bound method _TrackTimeInterval._interval_listener of _TrackTimeInterval(hass=<HomeAssistant RUNNING>, seconds=10.0, job_name='EntityPlatform poll media_player.sox: track time interval 10.0 <bound method EntityPlatform._async_handle_interval_callback of <EntityPlatform domain=media_player platform_name=sox config_entry=None>>', action=<bound method EntityPlatform._async_handle_interval_callback of <EntityPlatform domain=media_player platform_name=sox config_entry=None>>, cancel_on_shutdown=None, _track_job=<Job EntityPlatform poll media_player.sox: track time interval 10.0 <bound method EntityPlatform._async_handle_interval_callback of <EntityPlatform domain=media_player platform_name=sox config_entry=None>> HassJobType.Callback <bound method _TrackTimeInterval._interval_listener of ...>>, _run_job=<Job track time interval 10.0 HassJobType.Callback <bound method EntityPlatform._async_handle_interval_callback of <EntityPlatform domain=media_player platform_name=sox config_entry=None>>>, _cancel_callback=<bound method TimerHandle.cancel of <TimerHandle when=272330.417061447 _run_async_call_action(<HomeAssistant RUNNING>, <Job EntityPlatform poll media_player.sox: track time interval 10.0 <bound method EntityPlatform._async_handle_interval_callback of <EntityPlatform domain=media_player platform_name=sox config_entry=None>> HassJobType.Callback <bound method _TrackTimeInterval._interval_listener of ...>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:1506 created at /usr/src/homeassistant/homeassistant/helpers/event.py:1530>>)>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:1506 created at /usr/src/homeassistant/homeassistant/helpers/event.py:1530> took 3.065 seconds

I think the problem is that this integration uses socket instead of asyncio streams, and should therefore wrap the _send method with hass.async_add_executor_job so it doesn't block the event loop.

This would be good even if the vacuum cleaner is online, but it is particularly bad when offline as the socket has to wait for a timeout before letting the event loop thread go on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant