Changed the algorithm of the start method
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user