henry3260 commented on code in PR #65587:
URL: https://github.com/apache/airflow/pull/65587#discussion_r3488420248


##########
airflow-core/src/airflow/api_fastapi/execution_api/app.py:
##########
@@ -391,14 +406,20 @@ async def always_allow(request: Request):
 
         return self._app
 
+    @cached_property
+    def asgi_app(self) -> ASGIApp:
+        if self.request_scoped_server_context:
+            return _RequestScopedServerContextApp(self.app)
+        return self.app

Review Comment:
   > It seems no need to introduce another `cached_property`, making change at 
end of existing `app` `cached_property` would be sufficient.
   
   I found that wrapping at `.app` changes the contract of `.app`: it may 
return either the FastAPI app or `_RequestScopedServerContextApp`. Some callers 
still need the real FastAPI app to configure `dependency_overrides`, so 
returning the wrapper there causes `AttributeError`.
   
   I moved the wrapper into `.transport` / `.atransport` instead. That keeps 
`.app` stable as the FastAPI app, and applies the server context only when a 
request is executed.



-- 
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]

Reply via email to