Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider making the
cacheduration configurable via a parameter (similar totimeout) instead of hardcoding1sin each query so different deployments can tune caching without editing the template. - Since the same
uriandendpoints=charge_stateare repeated for each query, you might want to factor this out into a shared template/partial or YAML anchor to reduce duplication and the chance of inconsistencies in future changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider making the `cache` duration configurable via a parameter (similar to `timeout`) instead of hardcoding `1s` in each query so different deployments can tune caching without editing the template.
- Since the same `uri` and `endpoints=charge_state` are repeated for each query, you might want to factor this out into a shared template/partial or YAML anchor to reduce duplication and the chance of inconsistencies in future changes.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
|
Hi, we have in-memory caching for VehicleData responses (per-endpoint, per-VIN, configurable via vehicleDataCacheTime, default 30 seconds), which reduces BLE connections. So we should not have a problem with multiple request in a short period. We currently don't have HTTP cache headers set for VehicleData responses. |
Member
Author
|
Thank you, then this PR should reduce number of requests. If your internal caching sends headers in future we can drop this again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@wimaha would that work? Wasn't sure if HTTP cache headers are already supported. If not, this will force caching and reduce number of requests.