fix(agent): fail closed on incident read drift
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 2m31s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
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 2m31s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -31,6 +31,22 @@ async def _heartbeat_loop(shutdown_event: asyncio.Event) -> None:
|
||||
pass
|
||||
|
||||
|
||||
async def _init_optional_projection_redis() -> bool:
|
||||
"""Keep the controlled executor available when the Redis read model is down."""
|
||||
|
||||
try:
|
||||
await init_redis_pool()
|
||||
return True
|
||||
except Exception as exc:
|
||||
logger.warning(
|
||||
"ansible_execution_broker_redis_projection_degraded",
|
||||
error_type=type(exc).__name__,
|
||||
controlled_executor_available=True,
|
||||
durable_source="postgresql",
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
async def _main() -> None:
|
||||
if not settings.ENABLE_AWOOOP_ANSIBLE_CHECK_MODE_WORKER:
|
||||
raise RuntimeError("ansible_execution_broker_disabled_by_config")
|
||||
@@ -40,7 +56,7 @@ 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()
|
||||
redis_projection_ready = await _init_optional_projection_redis()
|
||||
|
||||
shutdown_event = asyncio.Event()
|
||||
|
||||
@@ -73,6 +89,8 @@ async def _main() -> None:
|
||||
settings.AWOOOP_ANSIBLE_CONTROLLED_APPLY_ALLOWED_RISK_LEVELS
|
||||
),
|
||||
worker_raw_credential_access=False,
|
||||
redis_projection_ready=redis_projection_ready,
|
||||
redis_projection_blocks_executor=False,
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user