jason810496 commented on code in PR #62214:
URL: https://github.com/apache/airflow/pull/62214#discussion_r2834327077
##########
airflow-core/src/airflow/api_fastapi/app.py:
##########
@@ -138,7 +140,12 @@ def get_auth_manager_cls() -> type[BaseAuthManager]:
def create_auth_manager() -> BaseAuthManager:
"""Create the auth manager."""
auth_manager_cls = get_auth_manager_cls()
- _AuthManagerState.instance = auth_manager_cls()
+ if _AuthManagerState.instance is None or not
isinstance(_AuthManagerState.instance, auth_manager_cls):
+ with _AuthManagerState._lock:
+ if _AuthManagerState.instance is None or not isinstance(
+ _AuthManagerState.instance, auth_manager_cls
+ ):
+ _AuthManagerState.instance = auth_manager_cls()
Review Comment:
We can even avoid calling `get_auth_manager_cls` on every
`create_auth_manager` call:
https://github.com/apache/airflow/pull/61310#discussion_r2751276702
--
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]