-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Observations
We probably cache more than necessary.
On the other hand, we do not cache the text responses of GetValue calls, which would be useful to avoid the differences between dbus-spy responses and the response to HTTP GET /victron/cache, compare this comment.
Example to explain the differences between dbus-spy and GET /victron/cache responses, using the property AvailableTemperatureServices of com.victronenergy.system:
- dbus-spy responds with a nicely readable text representation:
$ dbus -y com.victronenergy.system /AvailableTemperatureServices GetValue
{'default': 'Automatic', 'nosensor': 'No sensor'}- When calling
GET /victron/cache, we get the actual value response ofGetValuestringified (basicallyJSON.stringify()applied to the dbus value:
$ curl --silent --insecure https://venus.local:1881/victron/cache | jq '."com.victronenergy.system/0" ."/AvailableTemperatureServices"'
"[[\"default\",[[{\"type\":\"s\",\"child\":[]}],[\"Automatic\"]]],[\"nosensor\",[[{\"type\":\"s\",\"child\":[]}],[\"No sensor\"]]]]"- Before the PR, we got the raw object (not stringified):
curl --silent --insecure https://venus.local:1881//victron/cache | jq '."com.victronenergy.system/0" ."/AvailableTemperatureServices"'
[
[
"default",
[
[
{
"type": "s",
"child": []
}
],
[
"Automatic"
]
]
],
[
"nosensor",
[
[
{
"type": "s",
"child": []
}
],
[
"No sensor"
]
]
]
]Expectations
-
We should cache only what we need, to minimize main memory utilization. As we are not able to track who or what uses the HTTP endpoint
GET /victron/cache, it is risky to just remove or change (parts of) the cache. -
The response format differences are confusing, and may lead to bugs, so we should align our responses to
/victron/cachewith the responses todbus-spy.