amoghrajesh commented on code in PR #66073:
URL: https://github.com/apache/airflow/pull/66073#discussion_r3173351649
##########
airflow-core/src/airflow/state/__init__.py:
##########
@@ -36,3 +36,14 @@ def resolve_state_backend() -> type[BaseStateBackend]:
f"Your custom state backend `{clazz.__name__}` is not a subclass
of `BaseStateBackend`."
)
return clazz
+
+
+_backend_instance: BaseStateBackend | None = None
+
+
+def get_state_backend() -> BaseStateBackend:
+ """Return a cached instance of the configured state backend."""
+ global _backend_instance
+ if _backend_instance is None:
+ _backend_instance = resolve_state_backend()()
Review Comment:
Fixed with locking
--
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]