관리자 상태 기록 보존 정책을 API 안에서 하루 한 번 실행한다
소유자가 2026-10-27 실제 적용과 정기 실행을 승인했다. 원본 90일·집계 365일· 집계 대상 7일 창은 2026-10-20 운영 dry-run과 같은 값으로 고정하고, 데이터를 지우는 작업이라 기본값은 꺼짐이다. DB 풀이 정상일 때만 예약하며 실패는 기록만 하고 다음 회차를 계속한다. NAS compose는 환경변수를 명시 전달하므로 설정 3개를 api 환경에 추가한다.
This commit is contained in:
parent
8d6201e19e
commit
b6de32c1dd
6 changed files with 210 additions and 0 deletions
|
|
@ -60,6 +60,7 @@ from .routes import voice as voice_routes
|
|||
from .services.notifications import ensure_notification_tables
|
||||
from .services.protocol_registry import ensure_protocol_tables
|
||||
from .services import (
|
||||
admin_health_maintenance,
|
||||
alliance_measurement,
|
||||
continuous_improvement_producer,
|
||||
supervision_research_producer,
|
||||
|
|
@ -84,6 +85,7 @@ async def lifespan(app: FastAPI):
|
|||
|
||||
DB 미가용(Docker off / NAS 연결불가)이면 store 인메모리 폴백으로 degraded 기동한다.
|
||||
"""
|
||||
db_pool_ready = False
|
||||
measurement_schema_ready = False
|
||||
outcome_trajectory_schema_ready = False
|
||||
rupture_repair_schema_ready = False
|
||||
|
|
@ -229,6 +231,7 @@ async def lifespan(app: FastAPI):
|
|||
if settings.auto_seed_personas:
|
||||
await materialize_seed_personas()
|
||||
await admin_routes.apply_engine_config_from_store()
|
||||
db_pool_ready = True
|
||||
except Exception as exc: # DB 없어도 store 폴백으로 1턴 동작 (dev/로컬)
|
||||
if settings.environment != "dev" or upload_manifest_proof is not None:
|
||||
raise
|
||||
|
|
@ -254,11 +257,14 @@ async def lifespan(app: FastAPI):
|
|||
supervision_research_producer.schedule_supervision_research_producer()
|
||||
if continuous_improvement_schema_ready:
|
||||
continuous_improvement_producer.schedule_continuous_improvement_producer()
|
||||
if db_pool_ready:
|
||||
admin_health_maintenance.schedule_admin_health_retention()
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
await continuous_improvement_producer.stop_continuous_improvement_producer()
|
||||
await supervision_research_producer.stop_supervision_research_producer()
|
||||
await admin_health_maintenance.stop_admin_health_retention()
|
||||
session_routes.cancel_missing_session_evaluation_recovery()
|
||||
await voice_service.shutdown()
|
||||
await jev_client.shutdown()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue