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.
This commit is contained in:
dave 2019-07-13 15:48:49 -07:00
parent 50a55f08df
commit 0482dcc3ac
2 changed files with 4 additions and 2 deletions

View File

@ -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}})

View File

@ -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)