refactor: add synchronous service retrieval method to ServiceRegistry

This commit is contained in:
Will Miao
2025-07-26 07:05:27 +08:00
parent 3cf9121a8c
commit ea29cbeb7a

View File

@@ -35,6 +35,18 @@ class ServiceRegistry:
"""
return cls._services.get(name)
@classmethod
def get_service_sync(cls, name: str) -> Optional[Any]:
"""Synchronously get a service instance by name
Args:
name: Service name identifier
Returns:
Service instance or None if not found
"""
return cls._services.get(name)
@classmethod
def _get_lock(cls, name: str) -> asyncio.Lock:
"""Get or create a lock for a service