Skip to content

Offload blocking YAML dump to executor in sensor.py#806

Merged
ic-dev21 merged 2 commits intodvd-dev:mainfrom
Moustachauve:offload-yaml-dump-to-executor
Feb 17, 2026
Merged

Offload blocking YAML dump to executor in sensor.py#806
ic-dev21 merged 2 commits intodvd-dev:mainfrom
Moustachauve:offload-yaml-dump-to-executor

Conversation

@Moustachauve
Copy link
Copy Markdown
Contributor

The _save_history method in HiloRewardSensor was performing a synchronous yaml.dump on the main event loop, causing blocking. This change offloads the serialization to the default executor using asyncio.get_running_loop().run_in_executor, ensuring the main loop remains responsive.

Fixes the TODO item at custom_components/hilo/sensor.py:781.

Created from Moustachauve/WLED-Android#55 in Jules

The `_save_history` method in `HiloRewardSensor` was performing a synchronous `yaml.dump` on the main event loop, causing blocking. This change offloads the serialization to the default executor using `asyncio.get_running_loop().run_in_executor`, ensuring the main loop remains responsive.

Fixes the TODO item at custom_components/hilo/sensor.py:781.
@Moustachauve Moustachauve marked this pull request as draft December 6, 2025 17:33
@ic-dev21 ic-dev21 marked this pull request as ready for review February 17, 2026 00:17
Copy link
Copy Markdown
Collaborator

@ic-dev21 ic-dev21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ic-dev21 ic-dev21 merged commit 9cfa8da into dvd-dev:main Feb 17, 2026
3 checks passed
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 this pull request may close these issues.

2 participants