Fix caching API response caching bug (#48)

This commit is contained in:
Franck Nijhof 2021-01-15 20:28:19 +01:00 committed by GitHub
parent abd81ec1c9
commit 71aeb066fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -96,7 +96,7 @@ function bashio::core() {
fi fi
if bashio::cache.exists 'core.info'; then if bashio::cache.exists 'core.info'; then
info=$(bashio::cache.get 'supervisor.core') info=$(bashio::cache.get 'core.info')
else else
info=$(bashio::api.supervisor GET /core/info false) info=$(bashio::api.supervisor GET /core/info false)
bashio::cache.set 'core.info' "${info}" bashio::cache.set 'core.info' "${info}"

View file

@ -15,7 +15,7 @@
# $2 jq Filter to apply on the result (optional) # $2 jq Filter to apply on the result (optional)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
function bashio::info() { function bashio::info() {
local cache_key=${1:-'supervisor.info'} local cache_key=${1:-'info'}
local filter=${2:-} local filter=${2:-}
local info local info
local response local response
@ -27,11 +27,11 @@ function bashio::info() {
return "${__BASHIO_EXIT_OK}" return "${__BASHIO_EXIT_OK}"
fi fi
if bashio::cache.exists 'supervisor.info'; then if bashio::cache.exists 'info'; then
info=$(bashio::cache.get 'supervisor.info') info=$(bashio::cache.get 'info')
else else
info=$(bashio::api.supervisor GET /info false) info=$(bashio::api.supervisor GET /info false)
bashio::cache.set 'supervisor.info' "${info}" bashio::cache.set 'info' "${info}"
fi fi
response="${info}" response="${info}"

View file

@ -56,7 +56,7 @@ function bashio::os() {
fi fi
if bashio::cache.exists 'os.info'; then if bashio::cache.exists 'os.info'; then
info=$(bashio::cache.get 'supervisor.os') info=$(bashio::cache.get 'os.info')
else else
info=$(bashio::api.supervisor GET /os/info false) info=$(bashio::api.supervisor GET /os/info false)
bashio::cache.set 'os.info' "${info}" bashio::cache.set 'os.info' "${info}"