We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f15113 commit 5889c0bCopy full SHA for 5889c0b
source/jormungandr/jormungandr/utils.py
@@ -690,9 +690,8 @@ def can_connect_to_database():
690
if hasattr(g, 'can_connect_to_database'):
691
return g.can_connect_to_database
692
try:
693
- engine = models.db.engine
694
- connection = engine.connect()
695
- connection.close()
+ # Instead of creating a new connection to the database, better to test select on the smallest table.
+ models.db.engine.scalar('select version_num from alembic_version;')
696
g.can_connect_to_database = True
697
except Exception:
698
logging.getLogger(__name__).exception('Connection to database has failed')
0 commit comments