fix(agent): reconcile terminal incident read models
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m20s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
AI 技術雷達監控 / ai-technology-watch (push) Successful in 41s

This commit is contained in:
ogt
2026-07-11 19:56:24 +08:00
parent 8a0c916d82
commit 155ea47958
4 changed files with 261 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ from typing import Any
import structlog
from src.core.config import settings
from src.core.redis_client import close_redis_pool, init_redis_pool
from src.db.base import close_db
from src.jobs.awooop_ansible_check_mode_job import (
run_awooop_ansible_check_mode_loop,
@@ -39,6 +40,8 @@ async def _main() -> None:
if not ssh_key_path.is_file() or not known_hosts_path.is_file():
raise RuntimeError("ansible_execution_broker_transport_not_mounted")
await init_redis_pool()
shutdown_event = asyncio.Event()
def _shutdown_handler(signum: int, _frame: Any) -> None:
@@ -90,6 +93,7 @@ async def _main() -> None:
await task
except asyncio.CancelledError:
pass
await close_redis_pool()
await close_db()
_HEALTH_PATH.unlink(missing_ok=True)
_READY_PATH.unlink(missing_ok=True)