Skip to content

Commit

Permalink
Fix DB session health check when only one DB server.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Valsecchi committed Apr 7, 2017
1 parent 91cb6c9 commit d171c48
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions c2cwsgiutils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ def db_chooser_tween(request):

db_session = sqlalchemy.orm.scoped_session(
sqlalchemy.orm.sessionmaker(extension=ZopeTransactionExtension(), bind=rw_engine))
if settings[master_prefix + ".url"] != settings.get(slave_prefix + ".url"):
db_session.c2c_rw_bind = rw_engine
db_session.c2c_ro_bind = ro_engine
db_session.c2c_rw_bind = rw_engine
db_session.c2c_ro_bind = ro_engine
rw_engine.c2c_name = master_prefix
ro_engine.c2c_name = slave_prefix
return db_session, rw_engine, ro_engine
2 changes: 1 addition & 1 deletion c2cwsgiutils/health_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def check(request):
name = url
self._checks.append((name, check, level))

def add_custom_check(self, name, check_cb, level):
def add_custom_check(self, name, check_cb, level=1):
"""
Add a custom check
:param name: the name of the check
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages


VERSION = '0.9.0'
VERSION = '0.9.1'
HERE = os.path.abspath(os.path.dirname(__file__))
INSTALL_REQUIRES = open(os.path.join(HERE, 'rel_requirements.txt')).read().splitlines()

Expand Down

0 comments on commit d171c48

Please sign in to comment.