mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 02:24:08 +00:00
HubAuth: allow caching None responses
when a token doesn't identify a user, the response is None. These results are cached, but the cache checked for `is None`, causing failed-auth responses to effectively not be cached.
This commit is contained in:
@@ -277,11 +277,10 @@ class HubAuth(SingletonConfigurable):
|
|||||||
if cache_key is None:
|
if cache_key is None:
|
||||||
raise ValueError("cache_key is required when using cache")
|
raise ValueError("cache_key is required when using cache")
|
||||||
# check for a cached reply, so we don't check with the Hub if we don't have to
|
# check for a cached reply, so we don't check with the Hub if we don't have to
|
||||||
cached = self.cache.get(cache_key)
|
try:
|
||||||
if cached is not None:
|
return self.cache[cache_key]
|
||||||
return cached
|
except KeyError:
|
||||||
else:
|
app_log.debug("HubAuth cache miss: %s", cache_key)
|
||||||
app_log.debug("Cache miss: %s" % cache_key)
|
|
||||||
|
|
||||||
data = self._api_request('GET', url, allow_404=True)
|
data = self._api_request('GET', url, allow_404=True)
|
||||||
if data is None:
|
if data is None:
|
||||||
|
Reference in New Issue
Block a user