Make rattail config object use our scoped session, when consulting db.
Whoops, apparently we were previously creating a new session for each config check? Hopefully this helps...
This commit is contained in:
parent
74a13fb739
commit
6c8425b06d
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2015 Lance Edgar
|
# Copyright © 2010-2016 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
Application Entry Point
|
Application Entry Point
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals, absolute_import
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
@ -87,6 +87,10 @@ def make_rattail_config(settings):
|
||||||
rattail.db.Session.configure(bind=rattail_engines['default'])
|
rattail.db.Session.configure(bind=rattail_engines['default'])
|
||||||
tailbone.db.Session.configure(bind=rattail_engines['default'])
|
tailbone.db.Session.configure(bind=rattail_engines['default'])
|
||||||
|
|
||||||
|
# Make sure rattail config object uses our scoped session, to avoid
|
||||||
|
# unnecessary connections (and pooling limits).
|
||||||
|
rattail_config._session_factory = lambda: (tailbone.db.Session(), False)
|
||||||
|
|
||||||
# Configure (or not) Continuum versioning.
|
# Configure (or not) Continuum versioning.
|
||||||
configure_versioning(rattail_config)
|
configure_versioning(rattail_config)
|
||||||
return rattail_config
|
return rattail_config
|
||||||
|
|
Loading…
Reference in a new issue