From d171c489f88b0655aa271d4541febb2505e5ae52 Mon Sep 17 00:00:00 2001 From: Patrick Valsecchi Date: Fri, 7 Apr 2017 08:20:29 +0200 Subject: [PATCH] Fix DB session health check when only one DB server. --- c2cwsgiutils/db.py | 5 ++--- c2cwsgiutils/health_check.py | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/c2cwsgiutils/db.py b/c2cwsgiutils/db.py index 31f3a51ac..afc6264d4 100644 --- a/c2cwsgiutils/db.py +++ b/c2cwsgiutils/db.py @@ -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 diff --git a/c2cwsgiutils/health_check.py b/c2cwsgiutils/health_check.py index 9babc833b..43c423cd5 100644 --- a/c2cwsgiutils/health_check.py +++ b/c2cwsgiutils/health_check.py @@ -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 diff --git a/setup.py b/setup.py index 639d7a1fe..584ce36e5 100644 --- a/setup.py +++ b/setup.py @@ -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()