Remove extra call to the DB for a user we already have
This commit is contained in:
parent
729249f42b
commit
76bef38d71
1 changed files with 7 additions and 4 deletions
11
auth/auth.py
11
auth/auth.py
|
@ -33,10 +33,13 @@ def _load_user_from_cookie():
|
|||
return None
|
||||
|
||||
logger.debug('Loading user from cookie: %s', current_user.get_id())
|
||||
set_authenticated_user_deferred(current_user.get_id())
|
||||
loaded = QuayDeferredPermissionUser.for_user(current_user.db_user())
|
||||
identity_changed.send(app, identity=loaded)
|
||||
return current_user.db_user()
|
||||
db_user = current_user.db_user()
|
||||
if db_user is not None:
|
||||
set_authenticated_user(db_user)
|
||||
loaded = QuayDeferredPermissionUser.for_user(db_user)
|
||||
identity_changed.send(app, identity=loaded)
|
||||
return db_user
|
||||
|
||||
return None
|
||||
|
||||
|
||||
|
|
Reference in a new issue