From 0482dcc3acd885b6b68a78ba005bd49b9f7be14b Mon Sep 17 00:00:00 2001 From: dave Date: Sat, 13 Jul 2019 15:48:49 -0700 Subject: [PATCH] disable session locking for now we don't use sessions for anything critial. the custom database session library locks the session for commit, and this happens every request, which is not optimal. for now, disable session locking. --- photoapp/daemon.py | 2 ++ photoapp/dbsession.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/photoapp/daemon.py b/photoapp/daemon.py index aebbb29..2c7b726 100644 --- a/photoapp/daemon.py +++ b/photoapp/daemon.py @@ -473,6 +473,8 @@ def main(): '/static': {"tools.staticdir.on": True, "tools.staticdir.dir": os.path.join(APPROOT, "styles/dist") if not args.debug else os.path.abspath("styles/dist")}, + '/thumb': {'tools.expires.on': True, + 'tools.expires.secs': 7 * 86400}, '/login': {'tools.auth_basic.on': True, 'tools.auth_basic.realm': 'photolib', 'tools.auth_basic.checkpassword': validate_password}}) diff --git a/photoapp/dbsession.py b/photoapp/dbsession.py index 02f93bb..a9b536e 100644 --- a/photoapp/dbsession.py +++ b/photoapp/dbsession.py @@ -36,8 +36,8 @@ class DatabaseSession(cherrypy.lib.sessions.Session): def _load(self): if not self.cached: - self.cached = cherrypy.request.db.query(Session).filter(Session.session_id == self.id). \ - with_for_update().first() + self.cached = cherrypy.request.db.query(Session).filter(Session.session_id == self.id).first() + # with_for_update() if self.cached: return pickle.loads(self.cached.data)