john-rodriguez-mgni commented on code in PR #61483:
URL: https://github.com/apache/airflow/pull/61483#discussion_r2790068878


##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -41,6 +41,14 @@
 if TYPE_CHECKING:
     from airflow.serialization.definitions.param import SerializedParamsDict
 
+
+# Module-level serializer instance for file tokens.
+# This avoids creating a new serializer and calling conf.get_mandatory_value()
+# for every DAG when generating file tokens, which significantly improves
+# performance of the /ui/dags endpoint.
+_FILE_TOKEN_SERIALIZER: URLSafeSerializer = 
URLSafeSerializer(conf.get_mandatory_value("api", "secret_key"))

Review Comment:
   yeah previously I was using `@lru_cache` for lazy initialization but per 
@pierrejeambrun and @tirkarthi I made the change as it stands now. 
https://github.com/apache/airflow/pull/61483#discussion_r2783745753. I could 
switch this back to do lazy initalization using `@cache` instead if that is the 
preferred method.



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