quick fix to better handle pools, and db container restarts underneath client

This commit is contained in:
2026-02-04 17:25:59 +11:00
parent 5b0bfb3619
commit 7b1a7ea30d

View File

@@ -70,6 +70,15 @@ app.config['LDAP_GROUP_OBJECT_FILTER'] = '(objectclass=posixGroup)'
app.config['LDAP_BIND_USER_DN'] = None
app.config['LDAP_BIND_USER_PASSWORD'] = None
# stop db restarts from causing stales and client-side 'server errors' - its a
# touch hacky, e.g. it issues a select 1 before EVERY request, likely should
# ditch this and just have a short-lived pool, but need to work out if/where I
# can catch the right exception myself and then dont need this, but for now...
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {
"pool_pre_ping": True,
"pool_recycle": 280, # Good practice to include this with pre-ping
}
db = SQLAlchemy(app) # create the (flask) sqlalchemy connection
ma = Marshmallow(app) # set up Marshmallow - data marshalling / serialising