重新加载配置(修改配置后调用)
()
| 71 | |
| 72 | |
| 73 | async def reload_config(): |
| 74 | """重新加载配置(修改配置后调用)""" |
| 75 | global _config_cache, _config_initialized |
| 76 | |
| 77 | try: |
| 78 | from src.storage_adapter import get_storage_adapter |
| 79 | storage_adapter = await get_storage_adapter() |
| 80 | |
| 81 | # 如果后端支持 reload_config_cache,调用它 |
| 82 | if hasattr(storage_adapter._backend, 'reload_config_cache'): |
| 83 | await storage_adapter._backend.reload_config_cache() |
| 84 | |
| 85 | # 重新加载配置缓存 |
| 86 | _config_cache = await storage_adapter.get_all_config() |
| 87 | _config_initialized = True |
| 88 | except Exception: |
| 89 | pass |
| 90 | |
| 91 | |
| 92 | def _get_cached_config(key: str, default: Any = None) -> Any: |
nothing calls this directly
no test coverage detected