INNER CODE UNIT · Python
_log_config_reload_failure
yihong1120/Construction-Hazard-Detection · main.py:157
def _log_config_reload_failure(self, task: asyncio.Task[None]) -> None:
"""Log callback reload failures instead of losing the task error."""
if task.cancelled():
return
error = task.exception()
if error is not None:
self.logger.error(f"[config] Immediate reload failed: {error}")
async def _cancel_config_reload_task(self) -> None:
"""Cancel an in-flight callback reload before process shutdown."""
task = self._config_reload_task
self._config_reload_task = None
if task is None or task.done() or task is asyncio.current_task():
return
task.cancel()
with suppress(asyncio.CancelledError):
await task