Changed the algorithm of the start method

This commit is contained in:
2025-11-01 21:00:14 +03:00
parent ffd758d9a4
commit 311870fd73
3 changed files with 9 additions and 8 deletions

View File

@@ -104,21 +104,21 @@ class ConfigManager:
finally:
self.logger.info("ConfigManager stopped")
def start(self) -> None:
"""Запускает менеджер конфигурации в текущем event loop"""
async def start(self) -> None:
if self._task is not None and not self._task.done():
self.logger.warning("ConfigManager is already running")
return
try:
self._loop = asyncio.get_running_loop()
except RuntimeError:
self.logger.error("start() must be called from within an async context")
raise
self._task = self._loop.create_task(self._run())
self.logger.info("ConfigManager task created")
async def stop(self) -> None:
"""Останавливает менеджер конфигурации и ожидает завершения"""
if self._task is None: