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

Throttle updates #213

Merged
merged 1 commit into from
Nov 9, 2024
Merged

Throttle updates #213

merged 1 commit into from
Nov 9, 2024

Conversation

jschlyter
Copy link
Contributor

Use homeassistant.utils.Throttle to protect against to frequent updates.

@jschlyter jschlyter requested a review from a team as a code owner November 9, 2024 13:05
Copy link

@wouterhardeman wouterhardeman left a comment

Choose a reason for hiding this comment

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

This looks good to me!

Although I'm assuming the scan_interval is added as a property to make it configurable at a later stage? If not, I think using an attribute on the async_update function itself is cleaner as seen here: https://github.com/home-assistant/core/blob/2cc54867944d804f7033f0ff3f5e458ec579aabe/homeassistant/components/openhardwaremonitor/sensor.py#L144

@jschlyter
Copy link
Contributor Author

Although I'm assuming the scan_interval is added as a property to make it configurable at a later stage?

Yes, that was my idea.

@jschlyter jschlyter merged commit 04b39a1 into pypolestar:main Nov 9, 2024
3 checks passed
@jschlyter jschlyter deleted the throttle_updates branch November 12, 2024 09:21
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