From cc72ded27197619ea21c340c5654893754fab543 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Fri, 6 Jul 2018 14:47:09 +0200 Subject: [PATCH] caches: skip cache if user is empty. --- rhodecode/authentication/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rhodecode/authentication/base.py b/rhodecode/authentication/base.py index 2b01ee62..e2f02076 100644 --- a/rhodecode/authentication/base.py +++ b/rhodecode/authentication/base.py @@ -694,7 +694,9 @@ def authenticate(username, password, environ=None, auth_type=None, log.debug('AUTH_CACHE_TTL for plugin `%s` active: %s (TTL: %s)', plugin.get_id(), plugin_cache_active, cache_ttl) - user_id = user.user_id + user_id = user.user_id if user else None + # don't cache for empty users + plugin_cache_active = plugin_cache_active and user_id cache_namespace_uid = 'cache_user_auth.{}'.format(user_id) region = rc_cache.get_or_create_region('cache_perms', cache_namespace_uid)