Added another check in case cached object failed
This commit is contained in:
parent
fa8231eb71
commit
d79f1d53a8
1 changed files with 1 additions and 1 deletions
|
@ -135,7 +135,7 @@ async def get_content(key: str):
|
||||||
# We want to check here if the key exists in cache, and it was not created more than an hour ago
|
# We want to check here if the key exists in cache, and it was not created more than an hour ago
|
||||||
# We also want to make sure that if what we're getting in cache has content
|
# We also want to make sure that if what we're getting in cache has content
|
||||||
# if not, lets make sure something didn't go awry, by getting from the database instead
|
# if not, lets make sure something didn't go awry, by getting from the database instead
|
||||||
if cached is None or isinstance(cached, {}) or len(cached.values) == 0 or (
|
if cached is None or isinstance(cached, dict) or len(cached.values) == 0 or (
|
||||||
pendulum.utcnow() - cached.refreshed).hours >= 1:
|
pendulum.utcnow() - cached.refreshed).hours >= 1:
|
||||||
value = await _get_content(key)
|
value = await _get_content(key)
|
||||||
# If we found this object not cached, cache it
|
# If we found this object not cached, cache it
|
||||||
|
|
Loading…
Reference in a new issue