File tree Expand file tree Collapse file tree
src/airflow/providers/fab/www Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818from __future__ import annotations
1919
2020from datetime import timedelta
21+ from functools import cache
2122from os .path import isabs
2223
2324from flask import Flask
4445from airflow .providers .fab .www .extensions .init_wsgi_middlewares import init_wsgi_middleware
4546from airflow .providers .fab .www .utils import get_session_lifetime_config
4647
47- app : Flask | None = None
48-
4948# Initializes at the module level, so plugins can access it.
5049# See: /docs/plugins.rst
5150csrf = CSRFProtect ()
@@ -119,15 +118,12 @@ def create_app(enable_plugins: bool):
119118 return flask_app
120119
121120
121+ @cache
122122def cached_app ():
123123 """Return cached instance of Airflow WWW app."""
124- global app
125- if not app :
126- app = create_app ()
127- return app
124+ return create_app ()
128125
129126
130127def purge_cached_app ():
131128 """Remove the cached version of the app in global state."""
132- global app
133- app = None
129+ cached_app .cache_clear ()
Original file line number Diff line number Diff line change 1- 48926a5d09f218deb70a461d36aecec7e883a2210dea809082c99dbf0bd8d77d
1+ 9a7fd1175fa3e57b636662428771b3c9586be5551fe96e8dc35afffd792229d1
You can’t perform that action at this time.
0 commit comments