- Improvements and bugfixes to HealthChecks
This commit is contained in:
@@ -76,20 +76,24 @@ def create_app(config_file=None):
|
||||
app.logger.debug('Token request detected, skipping JWT verification')
|
||||
return
|
||||
|
||||
try:
|
||||
verify_jwt_in_request(optional=True)
|
||||
tenant_id = get_jwt_identity()
|
||||
app.logger.debug(f'Tenant ID from JWT: {tenant_id}')
|
||||
# Check if this a health check request
|
||||
if request.path.startswith('/_healthz') or request.path.startswith('/healthz'):
|
||||
app.logger.debug('Health check request detected, skipping JWT verification')
|
||||
else:
|
||||
try:
|
||||
verify_jwt_in_request(optional=True)
|
||||
tenant_id = get_jwt_identity()
|
||||
app.logger.debug(f'Tenant ID from JWT: {tenant_id}')
|
||||
|
||||
if tenant_id:
|
||||
Database(tenant_id).switch_schema()
|
||||
app.logger.debug(f'Switched to schema for tenant {tenant_id}')
|
||||
else:
|
||||
app.logger.debug('No tenant ID found in JWT')
|
||||
except Exception as e:
|
||||
app.logger.error(f'Error in before_request: {str(e)}')
|
||||
# Don't raise the exception here, let the request continue
|
||||
# The appropriate error handling will be done in the specific endpoints
|
||||
if tenant_id:
|
||||
Database(tenant_id).switch_schema()
|
||||
app.logger.debug(f'Switched to schema for tenant {tenant_id}')
|
||||
else:
|
||||
app.logger.debug('No tenant ID found in JWT')
|
||||
except Exception as e:
|
||||
app.logger.error(f'Error in before_request: {str(e)}')
|
||||
# Don't raise the exception here, let the request continue
|
||||
# The appropriate error handling will be done in the specific endpoints
|
||||
|
||||
return app
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ def liveness():
|
||||
def readiness():
|
||||
checks = {
|
||||
"database": check_database(),
|
||||
"celery": check_celery(),
|
||||
# "celery": check_celery(),
|
||||
"minio": check_minio(),
|
||||
# Add more checks as needed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user