Avoid caching when API call fails (#164)

This commit is contained in:
Stefan Agner 2025-04-22 12:28:35 +02:00 committed by GitHub
parent d70505aada
commit 445707a903
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 104 additions and 0 deletions

View file

@ -99,6 +99,10 @@ function bashio::core() {
info=$(bashio::cache.get 'core.info')
else
info=$(bashio::api.supervisor GET /core/info false)
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
bashio::log.error "Failed to get core info from Supervisor API"
return "${__BASHIO_EXIT_NOK}"
fi
bashio::cache.set 'core.info' "${info}"
fi
@ -249,6 +253,10 @@ function bashio::core.stats() {
info=$(bashio::cache.get 'core.stats')
else
info=$(bashio::api.supervisor GET /core/stats false)
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
bashio::log.error "Failed to get core stats from Supervisor API"
return "${__BASHIO_EXIT_NOK}"
fi
bashio::cache.set 'core.stats' "${info}"
fi