Implement template rate limits#40667
Conversation
|
This should get some tests for the template directive outside of |
|
In a followup: Will need a websocket flag to set a rate limit as well after #40647 so pasting in a template that would overwhelm the system doesn't happen. |
After the refactoring in home-assistant#40667 this is no longer needed.
After the refactoring in home-assistant#40667 this is no longer needed.
|
I realized we can drop |
|
Maybe this should return an empty string
seems cleaner in contrast with:
but you could also do
so I guess I'll leave it as-is |
|
Should we have a default rate limit of 1 per second ? |
I thought about doing that, but I figured it would break automations that looking for a template sensor that was aggregating button states (probably remotes) to see if any of them were pressed if the press and release event happens inside the ratelimit window. I don't have a good handle on what the impact would be so I didn't do it. I'm thinking for the developer tools we should do that so you can test your template without much risk of overwhelming the system. |
|
I think |
After the refactoring in home-assistant#40667 this is no longer needed.
eefea3d to
0b685f6
Compare
After the refactoring in home-assistant#40667 this is no longer needed.
|
I'm not sure it actually saves anything because of the tight coupling, but maybe a |
0b685f6 to
e604c86
Compare
After the refactoring in home-assistant#40667 this is no longer needed. tweaks
314c66d to
f07f42f
Compare
After reviewing some of the initial 0.116 py-spy, I'm thinking that we should set a 1 second rate limit by default if they are accessing all states or watching a whole domain of states. The other case where they are watching for a single sensor or remote key seems unlikely if they are watching everything or all of sensor.*. They can always override it if they really need that level of granularity while tracking all of that |
1e8619d to
09fc139
Compare
Breaking change
In 0.115, support for watching all states and an entire domain of states was added to template tracking. To prevent the system from being overwhelmed when many state changed events coincide, re-evaluation of templates are limited to once per minute when all states or states for an ensure domain are accessed in the template. As before, no rate limit is imposed when the template only access states for specific entities or receives state changes events for specifically referenced entities.
Proposed change
Implement template rate limits from home-assistant/architecture#206
Type of change
Example entry for
configuration.yaml:# Example configuration.yamlAdditional information
rate_limitdirective. home-assistant.io#14631Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: