Commit 711d6ad9 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

astakos: Ensure computed result gets returned

Relying on cache.get is not always safe
parent 28cc06c4
......@@ -55,9 +55,8 @@ def get_visible_resources():
key = "resources"
result = cache.get(key)
if result is None:
cache.set(key, register.get_api_visible_resources(),
settings.RESOURCE_CACHE_TIMEOUT)
result = cache.get(key)
result = register.get_api_visible_resources()
cache.set(key, result, settings.RESOURCE_CACHE_TIMEOUT)
return result
......
......@@ -71,8 +71,8 @@ def get_endpoints():
key = "endpoints"
result = cache.get(key)
if result is None:
cache.set(key, compute_endpoints(), settings.ENDPOINT_CACHE_TIMEOUT)
result = cache.get(key)
result = compute_endpoints()
cache.set(key, result, settings.ENDPOINT_CACHE_TIMEOUT)
return result
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment