Commit 6f4f47b5 authored by Romain Loth's avatar Romain Loth

remove user cache entirely (it works fine by itself, but the app is later run...

remove user cache entirely (it works fine by itself, but the app is later run over multiple processes that have separate memory, so the cache can be updated in one process but not in another :/)
parent 9604aece
......@@ -41,7 +41,7 @@ if __package__ == 'services':
from services import db
from services import tools
from services.tools import mlog
from services.user import User, login_manager, doors_login, UCACHE
from services.user import User, login_manager, doors_login
from services.db_to_tina_api.extractDataCustom import MyExtractor
# TODO move sanitize there
# from services.text import keywords, sanitize
......@@ -51,7 +51,7 @@ else:
import db
import tools
from tools import mlog
from user import User, login_manager, doors_login, UCACHE
from user import User, login_manager, doors_login
from db_to_tina_api.extractDataCustom import MyExtractor
# from text import keywords, sanitize
......@@ -451,7 +451,6 @@ def profile():
"executing DELETE scholar's data at the request of user %s" % str(the_id_to_delete))
logout_user()
db.rm_scholar(the_id_to_delete)
if the_id_to_delete in UCACHE: UCACHE.pop(the_id_to_delete)
return(redirect(url_for('rootindex', _external=True)))
......@@ -698,10 +697,6 @@ def save_form(clean_records, update_flag=False):
# F) end connection
reg_db.close()
# clear cache concerning this scholar
# TODO class User method !!
if luid in UCACHE: UCACHE.pop(luid)
return luid
......
......@@ -23,9 +23,6 @@ else:
# will be exported to main for initialization with app
login_manager = LoginManager()
# scholar User objects cache
UCACHE = {}
@login_manager.user_loader
def load_user(mixedid):
"""
......@@ -40,13 +37,7 @@ def load_user(mixedid):
if testluid:
luid = int(testluid.groups()[0])
if luid in UCACHE:
u = UCACHE[luid]
mlog("DEBUG", "load_user: normal user re-loaded by cache")
else:
u = User(luid)
UCACHE[luid] = u
mlog("DEBUG", "load_user: normal user re-loaded from DB")
u = User(luid)
elif testduid:
doors_uid = testduid.groups()[0]
......
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