Добави логирование в работу worker loop
This commit is contained in:
@@ -81,9 +81,13 @@ class ConfigManager:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
async def _worker_loop(self) -> None:
|
async def _worker_loop(self) -> None:
|
||||||
|
self.logger.warning("Worker loop started")
|
||||||
|
try:
|
||||||
while not self._halt.is_set():
|
while not self._halt.is_set():
|
||||||
await asyncio.to_thread(self.execute)
|
await asyncio.to_thread(self.execute)
|
||||||
await asyncio.sleep(self.work_interval)
|
await asyncio.sleep(self.work_interval)
|
||||||
|
finally:
|
||||||
|
self.logger.warning("Worker loop stopped")
|
||||||
|
|
||||||
async def _periodic_update_loop(self) -> None:
|
async def _periodic_update_loop(self) -> None:
|
||||||
while not self._halt.is_set():
|
while not self._halt.is_set():
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ class ConfigManagerV2:
|
|||||||
|
|
||||||
async def _worker_loop(self) -> None:
|
async def _worker_loop(self) -> None:
|
||||||
"""Вызывать execute() циклически до запроса остановки."""
|
"""Вызывать execute() циклически до запроса остановки."""
|
||||||
|
logger.warning("Worker loop started")
|
||||||
logger.debug(f"Запускаем _worker_loop с интервалом {self.work_interval}")
|
logger.debug(f"Запускаем _worker_loop с интервалом {self.work_interval}")
|
||||||
worker = WorkerLoop(
|
worker = WorkerLoop(
|
||||||
execute=self.execute,
|
execute=self.execute,
|
||||||
@@ -137,7 +138,10 @@ class ConfigManagerV2:
|
|||||||
on_error=self._on_execute_error,
|
on_error=self._on_execute_error,
|
||||||
on_success=self._on_execute_success,
|
on_success=self._on_execute_success,
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
await worker.run()
|
await worker.run()
|
||||||
|
finally:
|
||||||
|
logger.warning("Worker loop stopped")
|
||||||
|
|
||||||
async def _periodic_update_loop(self) -> None:
|
async def _periodic_update_loop(self) -> None:
|
||||||
"""Периодически проверять файл конфига на обновления до остановки."""
|
"""Периодически проверять файл конфига на обновления до остановки."""
|
||||||
|
|||||||
Reference in New Issue
Block a user