This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new bdabf46d964 Remove global statement from Fab provider (#59018)
bdabf46d964 is described below

commit bdabf46d9641127e5478f0338ac30d4ca7569029
Author: Jens Scheffler <[email protected]>
AuthorDate: Sun Dec 7 17:10:25 2025 +0100

    Remove global statement from Fab provider (#59018)
---
 providers/fab/src/airflow/providers/fab/www/app.py | 12 ++++--------
 providers/fab/www-hash.txt                         |  2 +-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/providers/fab/src/airflow/providers/fab/www/app.py 
b/providers/fab/src/airflow/providers/fab/www/app.py
index 17bdf4d4f8d..57f21d95a4c 100644
--- a/providers/fab/src/airflow/providers/fab/www/app.py
+++ b/providers/fab/src/airflow/providers/fab/www/app.py
@@ -18,6 +18,7 @@
 from __future__ import annotations
 
 from datetime import timedelta
+from functools import cache
 from os.path import isabs
 
 from flask import Flask
@@ -44,8 +45,6 @@ from airflow.providers.fab.www.extensions.init_views import (
 from airflow.providers.fab.www.extensions.init_wsgi_middlewares import 
init_wsgi_middleware
 from airflow.providers.fab.www.utils import get_session_lifetime_config
 
-app: Flask | None = None
-
 # Initializes at the module level, so plugins can access it.
 # See: /docs/plugins.rst
 csrf = CSRFProtect()
@@ -119,15 +118,12 @@ def create_app(enable_plugins: bool):
     return flask_app
 
 
+@cache
 def cached_app():
     """Return cached instance of Airflow WWW app."""
-    global app
-    if not app:
-        app = create_app()
-    return app
+    return create_app()
 
 
 def purge_cached_app():
     """Remove the cached version of the app in global state."""
-    global app
-    app = None
+    cached_app.cache_clear()
diff --git a/providers/fab/www-hash.txt b/providers/fab/www-hash.txt
index fbffe8b5aaf..9f3df827ea1 100644
--- a/providers/fab/www-hash.txt
+++ b/providers/fab/www-hash.txt
@@ -1 +1 @@
-48926a5d09f218deb70a461d36aecec7e883a2210dea809082c99dbf0bd8d77d
+9a7fd1175fa3e57b636662428771b3c9586be5551fe96e8dc35afffd792229d1

Reply via email to