Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ping endpoint, closes #155 #158

Merged
merged 3 commits into from
Jul 9, 2018
Merged

Add ping endpoint, closes #155 #158

merged 3 commits into from
Jul 9, 2018

Conversation

dougppaz
Copy link
Contributor

@dougppaz dougppaz commented Jul 9, 2018

No description provided.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 772

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.119%

Totals Coverage Status
Change from base Build 763: 0.0%
Covered Lines: 1356
Relevant Lines: 1382

💛 - Coveralls

@dougppaz dougppaz merged commit e161cad into develop Jul 9, 2018
@dougppaz dougppaz deleted the issue/155 branch July 9, 2018 20:18
@@ -0,0 +1,23 @@
def check_database_connection(**kwargs):
Copy link

@eltonplima eltonplima Jul 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can improve this code like that:

def check_database_connection(**kwargs):
        for conn in connections.all():
            try:
                conn.cursor()
                return True
            except OperationalError:
                return False
        return False

def check_database_connection(**kwargs):
from django.db import connections
from django.db.utils import OperationalError
db_conn = connections['default']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are checking only default database connection. If you add N databases and if one of these databases goes down, your system return that's all is ok, and it's not true.
Check my previous consideration to a possible solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants