kalluripradeep commented on code in PR #64908:
URL: https://github.com/apache/airflow/pull/64908#discussion_r3067841323
##########
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/login.py:
##########
@@ -49,10 +49,9 @@ def _get_flask_app():
),
)
if not auth_manager.flask_app:
- raise HTTPException(
- status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
- detail="Flask app is not initialized. Check that FabAuthManager
started up correctly.",
- )
+ from airflow.providers.fab.www.app import create_app
+
+ auth_manager.flask_app = create_app(enable_plugins=False)
Review Comment:
Implemented a threading.Lock in FabAuthManager to guard the flask_app
initialization. This ensures that concurrent requests to the FastAPI endpoints
don't trigger redundant calls to create_app(), making the lazy loading
thread-safe.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]