testing entrypoint
This commit is contained in:
14
app.py
14
app.py
@@ -76,9 +76,21 @@ def create_app():
|
||||
@app.route('/health')
|
||||
def health_check():
|
||||
try:
|
||||
# Check database connection
|
||||
# Check database connection with a timeout
|
||||
db.session.execute(text('SELECT 1'))
|
||||
db.session.commit()
|
||||
|
||||
# Check if we can actually query a table
|
||||
try:
|
||||
User.query.first()
|
||||
except Exception as e:
|
||||
app.logger.error(f"Database query failed: {str(e)}")
|
||||
return jsonify({
|
||||
'status': 'unhealthy',
|
||||
'error': f"Database query failed: {str(e)}",
|
||||
'timestamp': datetime.utcnow().isoformat()
|
||||
}), 500
|
||||
|
||||
return jsonify({
|
||||
'status': 'healthy',
|
||||
'database': 'connected',
|
||||
|
||||
Reference in New Issue
Block a user