You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by js...@apache.org on 2025/11/23 22:02:17 UTC
(airflow) branch main updated: Remove global from log_server (#58598)
This is an automated email from the ASF dual-hosted git repository.
jscheffl 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 9f44c82f8a4 Remove global from log_server (#58598)
9f44c82f8a4 is described below
commit 9f44c82f8a4e0483c7dc1d6d2ee8e51d4a1af1f6
Author: Jens Scheffler <95...@users.noreply.github.com>
AuthorDate: Sun Nov 23 23:02:09 2025 +0100
Remove global from log_server (#58598)
---
airflow-core/src/airflow/utils/serve_logs/log_server.py | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/airflow-core/src/airflow/utils/serve_logs/log_server.py b/airflow-core/src/airflow/utils/serve_logs/log_server.py
index 16acd64c538..49f4df1ce5a 100644
--- a/airflow-core/src/airflow/utils/serve_logs/log_server.py
+++ b/airflow-core/src/airflow/utils/serve_logs/log_server.py
@@ -20,6 +20,7 @@ from __future__ import annotations
import logging
import os
+from functools import cache
from typing import cast
from fastapi import FastAPI, HTTPException, Request, status
@@ -157,12 +158,7 @@ def create_app():
return fastapi_app
-app = None
-
-
-def get_app():
- """Get or create the FastAPI app instance."""
- global app
- if app is None:
- app = create_app()
- return app
+@cache
+def get_app() -> FastAPI:
+ """Create a cached FastAPI app instance."""
+ return create_app()