コード例 #1
0
    def get(self):
        """displays the health of services"""

        # test DB
        session = Database().Session
        db_ok = False
        try:
            session.execute('SELECT 1')
            db_ok = True
        except Exception as e:
            log.error("DB not responding")
            log.debug(e)

        return {'database': db_ok}, HTTPStatus.OK
コード例 #2
0
    def get(self):
        """Experimental switch to fix db errors"""

        session = Database().Session

        try:
            session.execute('SELECT 1')

        except InvalidRequestError as e:
            log.error("DB nudge... Does this work?")
            log.debug(e)
            session.invalidate()
            session.rollback()

        finally:
            session.close()