changeset 7996:d654adfc5898

app: let app instance creation remove its SA Session when done The app instance is usually created early or on demand before serving the first request, and the app instance might sit idle for a while before receiving the first request. The app creation will touch the database, and we have to consider the lifetime of the database session it is using. The cbf524e4c1a3 commit message gives some reasons we should remove the session when done. But instead of handle it inside utility functions, we would rather handle sessions at a high level as here.
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 16 Nov 2019 16:57:27 +0100
parents 394c7814e710
children 58ea5a9ded33
files kallithea/config/app_cfg.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/app_cfg.py	Sat Nov 16 16:52:02 2019 +0100
+++ b/kallithea/config/app_cfg.py	Sat Nov 16 16:57:27 2019 +0100
@@ -34,6 +34,7 @@
 
 import kallithea.lib.locale
 import kallithea.model.base
+import kallithea.model.meta
 from kallithea.lib.middleware.https_fixup import HttpsFixup
 from kallithea.lib.middleware.permanent_repo_url import PermanentRepoUrl
 from kallithea.lib.middleware.simplegit import SimpleGit
@@ -181,6 +182,8 @@
 
     check_git_version()
 
+    kallithea.model.meta.Session.remove()
+
 
 hooks.register('configure_new_app', setup_configuration)